[11574] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5174 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 19 07:08:26 1999

Date: Fri, 19 Mar 99 04:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 19 Mar 1999     Volume: 8 Number: 5174

Today's topics:
        Array of Hash Problem (Jens Engelbrecht)
    Re: Complex Structure Question (Larry Rosler)
        Crypt problems dccobb@yahoo.com
    Re: Detecting a whitespace at the end of a string (Larry Rosler)
    Re: does perl discourage obfuscated code? (was Re: Perl (Larry Rosler)
        Files in perl/lib directory: help needed saching@my-dejanews.com
    Re: help with perl and win98 <seannln@bit-net.com>
    Re: Help: Conditional use of packages in Perl (Larry Rosler)
        How to connect to a SQL Server database ? <simon_ng@pacific.net.sg>
    Re: How to get a long filename from a shortened one? <seannln@bit-net.com>
    Re: How to redirect Output? <rick@rixsoft.com.fixme>
        INFINATE LOOPS IN PERL <c-denman@dircon.co.uk>
    Re: INFINATE LOOPS IN PERL <Tony.Curtis@vcpc.univie.ac.at>
    Re: Mac Newbie: droplet question (Rory Campbell Lange)
    Re: Macperl NEWBIE filename question (Rory Campbell Lange)
    Re: more on & in a filename <seannln@bit-net.com>
    Re: Newby question.. (Larry Rosler)
    Re: open( BPP0, "+>/dev/bpp0" ); <zenin@bawdycaste.org>
        rand() Performance <asquith@macconnect.com>
    Re: Sorting Problem (Larry Rosler)
    Re: System call <seannln@bit-net.com>
    Re: Unicode/Base64 ? <gisle@aas.no>
    Re: URL Decoding??? (Ethan H. Poole)
    Re: Variables in QUERY_STRING <Tony.Curtis@vcpc.univie.ac.at>
    Re: || vs "or" (David Cantrell)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 19 Mar 1999 10:23:47 +0100
From: engelbrecht@t-online.de (Jens Engelbrecht)
Subject: Array of Hash Problem
Message-Id: <36F217A3.C7B64DB7@dachs.de>

Hello,

I hope someone can help me with that problem.
I have created an array of a hash.

$sites = [{"link" => "www.programmersparadise.com",  "titel"=>"How to
use Perl"},{...}];

#Now I am saving it to a file.

open (DATEI, ">f:\\sites.dat");
print DATEI @sites;
close DATEI;

OK so far;
In another sub I am trying to read it now.

sub headlines {
  open (DATEI, "<f:\\sites.dat");
  @sites = <DATEI>;
  close DATEI;
  print @sites;                  #gives me something like "HASH(0x0d234)

 ..."
  print $sites[0]{"link"};    #gives me an error
}

What have I missed ?
Thanks for helping

Jens Engelbrecht

--
Dachs - Das Bvrsenmagazin
www.dachs.de




------------------------------

Date: Mon, 15 Mar 1999 16:24:52 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Complex Structure Question
Message-Id: <MPG.115744b0f455267a989758@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <x3ylnh2ensy.fsf@tigre.matrox.com> on Fri, 12 Mar 1999 
10:21:34 -0500, Ala Qumsieh <aqumsieh@matrox.com> says...
 ...
> % perl -w
> my %hash;
> $hash{'a'} = 'a';
> $hash{'a'}{'b'} = 'b';
> print "$hash{'a'} and $hash{'a'}{'b'}.\n";
> __END__
> a and b.
> 
> But, under 'use strict' it complains:
> 
> Can't use string ("a") as a HASH ref while "strict refs" in use at - line 4.
> 
> IMHO, the behaviour (without use strict) is broken. The result should
> be something like:
> 
> HASH(0xb851c) and b.
> 
> Is there a good explanation for this?

Yes, but you won't like it.  Your expectation seems to be that $hash{a} 
is a reference to an anonymous hash.  But nothing in your code sets that 
hash up.  Instead $hash{a} is set to the value 'a', so your second 
assignment (of 'b') uses that value ('a') as the reference to the hash, 
and creates a hash with that name (autovivification).  But 'use strict;' 
saves you from your folly.

BTW, all your posts have been arriving several days late.  In some 
sense, they seem like echoes from the past, after threads have dried up.  
You might want to look into that.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 19 Mar 1999 09:45:16 GMT
From: dccobb@yahoo.com
Subject: Crypt problems
Message-Id: <7ct6ba$ge6$1@nnrp1.dejanews.com>

Problem: I have installed an apache server on top of an existing apache
server, however as I am not root user I cannot use the htpasswd program to
create passwords for users.

Am I right in saying that Apache uses "Cd" as its encrytion key (salt) or does
it use a random key?

As I cannot use htpasswd I have created a Perl program which uses crypt()
will this do the same job as htpasswd?

Any help is much appreciated, Dave

"Everything should be as simple as possible, but no simpler",
Albert Einstein.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Mon, 15 Mar 1999 13:41:57 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Detecting a whitespace at the end of a string
Message-Id: <MPG.11571e7d368d284e989755@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7cjsif$h43$1@nnrp1.dejanews.com> on Mon, 15 Mar 1999 
21:03:19 GMT, kate_stafford@my-dejanews.com <kate_stafford@my-
dejanews.com> says...
> I am writing a script using Activestate build 509. I am reading in a list of
> NT user groups that sometimes have a whitespace inside of them (i.e. "Domain
> Users"). The program that is generating the group names sticks a whitespace
> or sometimes 2 at the end of the string that I wish to chop. I came up with
> the following until loop:
> 
> until ($group =~ /^[A-Za-z][_0=9a-zA-Z]*$\b/)
> {
>    chop $group;
> }

  $group =~ s/\s+$//;

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Mon, 15 Mar 1999 12:43:13 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <MPG.115710b85f0b40b1989752@nntp.hpl.hp.com>

In article <36ED60B9.C9783667@atrieva.com> on Mon, 15 Mar 1999 11:34:17 
-0800, Jerome O'Neil <jeromeo@atrieva.com> says...
> Russell Schulz wrote:
 ...
> You will hear no arguments from me that regular expressions are not
> obfuscatable, or obfuscated.  However, they are equally as obfuscated in
> C, Java, JavaScript, sed, or any other language that supports them. 
> This is not a perl problem.  It's a regex problem.
> 
> > partly because Perl is trying to DWIM on things, and it hides the fact
> > that $_ is not available at a particular place in a loop,
> 
> $_'s behavior is well documented, and easily understood.  You're asking
> the "Why don't the French understand Russian?" question.

Your statement above -- that obfuscation is a regex problem -- is 
exactly the same as what you dismiss here as the "Why don't the French 
understand Russian?" question.

Regexes are a separate language, no matter what vehicle they are 
embedded in.  Friedl's  masterly "Mastering Regular Expressions" treats 
them as such (and with their dialects).  Once they have been learned, 
they are no harder to deal with than a French person dealing with 
Russian after having learned it -- it depends on individually acquired 
skills.

Well-commented '/x'ed regexes are no harder to interpret than well-
written Perl code.  Uncommented un'/x'ed regexes are far easier for *me* 
to interpret than many JAPH's.  That is because of my relative number of 
years of personal acquaintance and practice, not because of the inherent 
obfuscatability of either form of expression.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 19 Mar 1999 10:06:19 GMT
From: saching@my-dejanews.com
Subject: Files in perl/lib directory: help needed
Message-Id: <7ct7in$hbb$1@nnrp1.dejanews.com>

Hello guys,

I use a unixware 1.1.2 machine. I have	perl, version 5.001 installed in
it..but i don't have all the files in perl/lib directory...no CGI, IPC, NET,
POSIX libraries.....my question is can i copy these files from a Sun-Solarsis
perl-5.004 version...if not where to find it (Unixware 1.1.2, perl 5.001)

Thanks a lot in advance....please answer to my e-mail id
(sachin@surya.pune.lucent.com) as i can't access net regularly...

Sachin Goyal
Bachelor of Enginneering (Computer Science)
BITS- PIlani INDIA
sachin@surya.pune.lucent.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Fri, 19 Mar 1999 06:41:55 -0500
From: Sean Phillips <seannln@bit-net.com>
To: Andrew Tipson <atipson@wesleyan.edu>
Subject: Re: help with perl and win98
Message-Id: <36F23803.C3BC830B@bit-net.com>

Andrew -

Here is a piece of code that I have used to do a similar task.   It
wouks UNIX, NT and 95 - I have not tried it on 98...

In this form, it works from the command line as
"perl cgigetdoc.pl http://www.slashdot.com/ultramode.txt"
But I'm sure that you can modify it to your liking...

#!/usr/bin/perl  -w
require 5.002;
use strict;
use Socket;

my ($host, $file, $proto, $port, $hisiaddr, $hispaddr, $cmdline,
$lineindex, $therest, $cookie);

$cmdline = shift || 'http://localhost/';
$cookie = shift || '';
$lineindex = index $cmdline, '//';
if ($lineindex < 0) {
   $therest = $cmdline;
} else {
   $therest = substr $cmdline, $lineindex + 2;
}
$lineindex = index $therest, '/';
$host = substr $therest, 0, $lineindex;
$file = substr $therest, $lineindex;

$proto = getprotobyname('tcp');
$port = getservbyname('http', 'tcp') || 80;

$| = 1;
$hisiaddr = inet_aton($host)     || die "unknown host";
$hispaddr = sockaddr_in($port, $hisiaddr);
socket(SOCKET, PF_INET, SOCK_STREAM, $proto)   || die "socket: $!";
connect(SOCKET, $hispaddr)          || die "bind: $!";
select(SOCKET); $| = 1; select(STDOUT);
print SOCKET "GET $file HTTP/1.0\n";
print SOCKET "Host: $host\n";
if ($cookie ne "") {
    print SOCKET "Cookie: $cookie\n";
}
print SOCKET "\n";
while (<SOCKET>) {
    print STDOUT $_;
}
close(SOCKET);
print STDOUT "\n";


Good luck,
- Sean




Andrew Tipson wrote:

> Hi, I'm under the sad restriction of using windows98 for this
> particular
> server, and I'm trying to access remote documents to parse for a daily
>
> news update.  Unfortunately, my knowledge of how to do this is limited
>
> to unix, and none of those system commands work directly from windows.
>
> How can I do it win windows?  Basically I want to read
> http://www.slashdot.com/ultramode.txt into an array, which I'll then
> parse accordingly.  What should I use to download this remote
> document?
> Any example code would be very much appreciated.





------------------------------

Date: Mon, 15 Mar 1999 12:51:14 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help: Conditional use of packages in Perl
Message-Id: <MPG.1157129d5c614ca6989753@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7cjpcn$ds5$1@nnrp1.dejanews.com> on Mon, 15 Mar 1999 
20:09:04 GMT, edward@echarge.com <edward@echarge.com> says...
 ...
> if (condition is true)
>   use package1;
> else
>   use package2;
> 
> It appears that Perl simply ignores the if statements and imports both
> packages regardless.  Please let me know if anyone has a solution.  Thanks in
> advance.

BEGIN {
  if (condition is true)
    use package1;
  else
    use package2;
}

If the condition is not known before the program is executed, consider 
using 'require' instead of 'use'.

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 19 Mar 1999 20:03:35 +0800
From: Simon Ng <simon_ng@pacific.net.sg>
Subject: How to connect to a SQL Server database ?
Message-Id: <36F23D17.1B60112B@pacific.net.sg>

Hi how to connect to a SQL Server database using ODBC.

Thanks

Regards,
Simon Ng



------------------------------

Date: Fri, 19 Mar 1999 06:33:27 -0500
From: Sean Phillips <seannln@bit-net.com>
To: "Allan M. Due" <Allan@due.net>
Subject: Re: How to get a long filename from a shortened one?
Message-Id: <36F23607.DE4635B1@bit-net.com>

Allen -

Thanks for the hint.   The solution you gave does not fix the mangled
directory though.   I have fixed the problem though...

What I did was to split the directory by the '\'s, then starting from
the base, reading the directory using dir /x and looking for the next
directory part.   If the directory part did not have a '~' in it, I took
it verbatum.

#!/usr/local/bin/perl -w
my $fullname = shift @ARGV;
@dirparts = split(/\\/,$fullname);
$numdirs = scalar @dirparts;
$fullname = $dirname = $dirparts[0];
for ($i=0;$i<$numdirs-1;$i++) {
   if ($dirpart[$i+1] =~ /\~{0}\) {
      $dirname .= "\\$dirparts[$i+1]";
      $fullname .= "\\$dirparts[$i+1]";
      next;
   }
   $commandstr = "dir $dirname\\";
   open FOLDER, "$commandstr |";
   while (<FOLDER>) {
      $listing = "$_" if (/$dirparts[$i+1]/i);
   }
   close FOLDER;
   @parseme = split(/\ {1,}/,$listing);
   $numtoparse = scalar @parseme;
   if ($parseme[1] eq "\<DIR\>") { #if dir [4] and on is what we need.
Else [6] and on...
      $thispart = $parseme[4];
      for ($j=5;$j<$numtoparse;$j++) {
         $thispart .=" $parseme[$j]";
      }
   } else {
      $thispart = $parseme[6];
      for ($j=7;$j<$numtoparse;$j++) {
         $thispart .=" $parseme[$j]";
      }
   }
   chomp $thispart;
   $dirname .= "\\$dirparts[$i+1]";
   $fullname .= "\\$thispart";
}
print $fullname;

I was hoping for a system call that would help ensure that the script
would be compatable with the upcoming Wondows NT 1903, but I guess I can
tweak it when the time comes...

Thanks,
- Sean

Allan M. Due wrote:

> Sean Phillips wrote in message <36EF203C.226210D4@bit-net.com>...
> :Windows NT/Perl question:
> :When you drag-n-drop a file onto a Perl program on the desktop the OS
>
> :feeds the filename to $ARGV[0].   Unfortunately, it will use the
> short
> :(8.3) filename.
> :Is there any way to translate it back to the long filename?
> :
> :I've tried a pipe from the command "dir /N $shortfilename" and while
> :that fixes the filename itself, the directory is still mangled.   The
>
> :utilities in Cwd don't seem to help either.
>
> Well,  here is what I have come up with.  I am not sure why there is a
>
> GetShortPathName but not a GetLongPathName.  I am not sure it would
> ever
> make a difference in this situations if you were to use the eq vs the
> match.
> I include them both in case it is helpful.  You would need to make
> sure that
> @files only has one element, if there are multiple matches obviously
> something has gone wrong <g>.
>
> #!/usr/local/bin/perl -w
> use strict;
> use Win32;
> use File::Basename;
>
> my $fullname = shift @ARGV;
> my ($name,$path) = fileparse($fullname);
>
> opendir (DIR,"$path") or warn "$!\n";
> #@files = grep {Win32::GetShortPathName("$path$_") =~ /$name/i}
> readdir(DIR);
> my @files = grep {Win32::GetShortPathName("$path$_") eq $fullname}
> readdir(DIR);
> close (DIR);
>
> HTH
>
> AmD
> --
> $email{'Allan M. Due'} = ' All@n.Due.net ';
> --random quote --
> People get annoyed when you try to debug them.
>  - Larry Wall





------------------------------

Date: Thu, 18 Mar 1999 19:19:37 -0500
From: Rick Osborne <rick@rixsoft.com.fixme>
Subject: Re: How to redirect Output?
Message-Id: <36F19819.11731448@rixsoft.com.fixme>

Quoth Pep Mico:

>I'm Using Activestate perl (perl for win32).
> myscript.pl > output.txt
>Why It doesn't work? How can i redirect the output of my Script?

This is in the FAQ.  (You have read the FAQ, haven't you?)  See:

http://www.activestate.com/support/faqs/win32/perlwin32faq5.html

As a general rule you want to not use NT's file association trickery when
attempting to do redirects.  Try:

  perl -w myscript.pl > output.txt

Oh, and read the Win32 FAQ.  ;)

--
Rick Osborne <rick at rixsoft dot com> -- Founder, Orlando Perl Mongers
Email me if you are in Central Florida and are interested in Perl
(or just like hanging out with people who are)


------------------------------

Date: Fri, 19 Mar 1999 11:27:44 -0800
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: INFINATE LOOPS IN PERL
Message-Id: <36f23462.0@glitch.nildram.co.uk>

Of course all code should be bug free, but as a security backup how could I
automatically shut down an instance of perl that has got itself into an
infinate loop.

What is happening, is that once in a blue moon, the code gets itself into a
loop and hogs the server.  None of my perl scripts should get into a loop
and should terminate within seconds.

Is it possible to detect whether a script is in a loop, or even if it has
been running for more than say, 20 seconds?  If so, can these programms be
terminated upon this detection?

I am running perl for win32, on NT4.

Ta,

Chris D




------------------------------

Date: 19 Mar 1999 12:46:49 +0100
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: INFINATE LOOPS IN PERL
Message-Id: <83zp597lcm.fsf@vcpc.univie.ac.at>

Re: INFINATE LOOPS IN PERL, Chris
<c-denman@dircon.co.uk> said:

[re. subject line: don't SHOUT! ]

Chris> itself into an infinate loop.

infinite

Chris> Is it possible to detect whether a script is
Chris> in a loop, or even if it has been running for

Not in general, it's called "The Halting Problem"
and is unsolvable.

Chris> more than say, 20 seconds?  If so, can these
Chris> programms be terminated upon this detection?

perldoc -f alarm.

Trigger an alarm after N seconds and catch it.  You
can then handle it by exiting the script (or
whatever).

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


------------------------------

Date: Fri, 19 Mar 1999 10:48:56 -0100
From: 'x'campbell-lange@easynet.co.uk (Rory Campbell Lange)
Subject: Re: Mac Newbie: droplet question
Message-Id: <'x'campbell-lange-1903991048560001@campbell-lange.easynet.co.uk>

Thanks for the notes, Ronald
I got the following useful advice on the applescript newsgroup:

So this is what you really wanted:

  #!perl -w
  use strict;
  use Fcntl;  # for sysopen
  my $file = shift @ARGV;

  if (! $file) {
    $file = MacPerl::DoAppleScript
      'choose file with prompt "Please select coordinate file"';
    $file =~ s/^alias "//;
    $file =~ s/"$//;
  }

  sysopen(IN, $file, O_RDONLY, 0) or die "Can't open '$file': $!";

Note that if sysopen() is confusing you and you know that you won't have
leading or trailing whitespace, you can do open(IN "< $file") ... .  I
just gave you the safest version.  open() is magic and sysopen() is not,
so sysopen() is safer when $file is unknown.

Hope this helps,

-- 
Chris Nandor          mailto:pudge@pobox.com  




In article <1dovyq7.wq5930l2noctN@[207.60.170.226]>,
rjk@linguist.dartmouth.edu (Ronald J Kimball) wrote:

> Rory Campbell Lange <'x'campbell-lange@easynet.co.uk> wrote:
> 
> >    if ($file != /(.)+/i) {                                     #problem
> 
> That should be
> 
>   $file !~ /(.)+/i
> 
> 
> But that should really be
> 
>   $file !~ /(.)+/
> 
> because you're not specifically matching any letters anyway.
> 
> 
> But that should really be
> 
>   $file !~ /./
> 
> because you just want to see if the variable has a value.
> 
> 
> But that should really be
> 
>   $file ne ""
> 
> because you shouldn't use a regex for that.
> 
> 
> But that should really be
> 
>   not defined $file
> 
> because you really want to know whether $file has a defined value.
> 
> 
> :)

-- 
Rory Campbell-Lange
The Campbell-Lange Workshop
Remove the 'x' to reply


------------------------------

Date: Fri, 19 Mar 1999 10:52:31 -0100
From: 'x'campbell-lange@easynet.co.uk (Rory Campbell Lange)
Subject: Re: Macperl NEWBIE filename question
Message-Id: <'x'campbell-lange-1903991052310001@campbell-lange.easynet.co.uk>

Sheepish grin
& thanks for the hint
(it seems almost too easy!)


In article <cjbrc7.bkb.ln@magna.metronet.com>, tadmc@metronet.com (Tad
McClellan) wrote:

> Rory Campbell Lange ('x'campbell-lange@easynet.co.uk) wrote:
> 
> : I am writing a quick script to rename long filenames so that they are
>                                  ^^^^^^
>                                  ^^^^^^  (hint hint)
> : suitable for DOS systems.
> : I don't know how to change the name of the file after having worked on it!
> 
> 
>    rename $oldname, $newname or die "could not rename  $!";
> 
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas

-- 
Rory Campbell-Lange
The Campbell-Lange Workshop
Remove the 'x' to reply


------------------------------

Date: Fri, 19 Mar 1999 06:47:17 -0500
From: Sean Phillips <seannln@bit-net.com>
To: Jerry Zhao <zzhao@execulink.com>
Subject: Re: more on & in a filename
Message-Id: <36F23945.E50CB722@bit-net.com>

Jerry -

Have you tried surrounding the filename in quotes?

- Sean

Jerry Zhao wrote:

> I encountered the problem in two occasions so far. One is that I have
> a
> directory whose name has the character '&' in it, and I want to use
> Perl to
> create a file of the same name that lists its contents. The other is
> that I
> have a Perl program that call an external image viewer to load jpg
> files.
> When I try to load files whose name contain '&', the image viewer
> gives
> error messages. For example, if the file name passed to the sub is
> "dirname/B&W01.jpg", the error message reads like this:
> ...dirname/.jpg not
> found...
>
> The following are excerpts from the second case:
> . . .
> push @hits, "$csv\/$name";
> }
> . . .
>
> #load scans by its index (number)
> $load->configure(-command => sub{&loadscan(\$hits[$scan->get-1])})
> }
>
> sub loadscan {
>
> use Win32;
> use Win32::Process;
>
> Win32::Process::Create(my $newPro,
> "C:\\program files\\irview\\i_view32.exe",
> "i_view32 c:\\${$_[0]}",
> 0,
> DETACHED_PROCESS,





------------------------------

Date: Mon, 15 Mar 1999 15:06:56 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newby question..
Message-Id: <MPG.1157326b4d478149989757@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36ED8CB8.9FA1A8C@lucent.com> on Mon, 15 Mar 1999 16:42:00 -
0600, Raymond C. Jender <rcj@lucent.com> says...
 ...
> @quot = split(/./,$temp1);

  @quot = split(/\./, $temp1);
                 ^

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 19 Mar 1999 09:37:03 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: open( BPP0, "+>/dev/bpp0" );
Message-Id: <921836435.289687@thrush.omix.com>

[posted & mailed]

James Smith <engjs@cc.newcastle.edu.au> wrote:
: If I use the following statement:
:
: 	open( BPP0, "+>/dev/bpp0" );

	+< might work better, as I'm not sure how the system will like you
	trying to truncate a device (or creating a real file in place of
	bpp0 if that device file doesn't exist). Checking the return value of
	open() might also help:

	open BPP0, '+</dev/bpp0'
	    or die "Can not open '/dev/bpp0': $!";

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: Tue, 16 Mar 1999 20:37:19 -0600
From: "William H. Asquith" <asquith@macconnect.com>
Subject: rand() Performance
Message-Id: <7cn4rn$1ns3@enews1.newsguy.com>

I need advice or confirmation about the rand() function.
I'm performing statistical simulations and I need a fairly
good random number generator.  I'm lazy and don't want to port
tested generators from Numerical Recipes in FORTRAN.  Can I
use the rand() function and be assured that for simulations
lengths (calls to rand()) on the order of 10**6 and statistically
independent?

-wha


------------------------------

Date: Mon, 15 Mar 1999 13:50:40 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting Problem
Message-Id: <MPG.115720897cedb7ee989756@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36ED68D0.8D14D81D@xs4all.nl> on Mon, 15 Mar 1999 21:08:48 
+0100, Frank de Bot <debot@xs4all.nl> says...
> I have an array:
> 
> $ar[0] = "14 || Some Text here";
> $ar[1] = "4 || Lalalala";
> $ar[2] = "7 || Hello World";
> 
> How can I sort that the array is this:
> 
> $ar[0] = "4 || Lalalala";
> $ar[1] = "7 || Hello World";
> $ar[2] = "14 || Some Text here";
> 
> I've tried everything, but nothing worked.

You've tried everything???  Did you try reading the following in 
perlfaq4:  "How do I sort an array by (anything)?" 

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 19 Mar 1999 06:54:00 -0500
From: Sean Phillips <seannln@bit-net.com>
Subject: Re: System call
Message-Id: <36F23AD7.674B10E7@bit-net.com>

Jody -

Make sure that the string that you are sending has "escaped" characters.

the command system "dir c:\windows"; would be passed to the operating
system as dir c:indows.   The call needs to have the non-alphanumeric
backslashed like: system "dir c\:\\windows" in order to get passed to
the OS correctly...

Hope this helps...
- Sean

theo5@my-dejanews.com wrote:

> Hi all,
>
> I hope someone can help.  I'm fairly new at this, been writing perl
> programs
> for about 9 months.  Perl is great EXCEPT when I make a system call
> using
> system.  I find that it gives really anomalous results.  For example,
> when a
> call works from the command line, the exact same call will not work
> using the
> system function from a perl script.  Does anyone know what is going
> on?
>
> Jody
>
> -----------== Posted via Deja News, The Discussion Network
> ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your
> Own





------------------------------

Date: 19 Mar 1999 07:44:56 +0100
From: Gisle Aas <gisle@aas.no>
Subject: Re: Unicode/Base64 ?
Message-Id: <m3yakuc713.fsf@eik.g.aas.no>

mkagalen@lynx02.dac.neu.edu (Michael Kagalenko) writes:

>  I am trying to clean up some mailings that were created by cutting and
>  pasting from various sources, incl. WWW. They have strings like
>  =92 (which stands for quotation mark). I tried to use MIME::Base64
>  and Unicode::String to convert them for printing, but it doesn't
>  work;
> 
>  use MIME::QuotedPrint;
> 
>  $enc='=92';
>  $dec = MIME::QuotedPrint::decode($enc);
>  print $dec;
> 
> Doesn't print anything. Any tips ?

It probably means that the document use the Microsoft version of the
ISO-Latin-1 character set.  This encoding adds visible characters in
the 0x80-0x9F range that Latin-1 leaves for control chars.  You can
perhaps try to substitute them with approximate Latin-1 chars.

#
#    Name:     cp1252_WinLatin1 to Unicode table
#    Unicode version: 2.0
#    Table version: 2.00
#    Table format:  Format A
#    Date:          04/24/96
#    Authors:       Lori Brownell <loribr@microsoft.com>
#                   K.D. Chang    <a-kchang@microsoft.com>
#    General notes: none
#
#    Format: Three tab-separated columns
#        Column #1 is the cp1252_WinLatin1 code (in hex)
#        Column #2 is the Unicode (in hex as 0xXXXX)
#        Column #3 is the Unicode name (follows a comment sign, '#')
#
#    The entries are in cp1252_WinLatin1 order
#

[...]

0x80            #UNDEFINED
0x81            #UNDEFINED
0x82    0x201A  #SINGLE LOW-9 QUOTATION MARK
0x83    0x0192  #LATIN SMALL LETTER F WITH HOOK
0x84    0x201E  #DOUBLE LOW-9 QUOTATION MARK
0x85    0x2026  #HORIZONTAL ELLIPSIS
0x86    0x2020  #DAGGER
0x87    0x2021  #DOUBLE DAGGER
0x88    0x02C6  #MODIFIER LETTER CIRCUMFLEX ACCENT
0x89    0x2030  #PER MILLE SIGN
0x8A    0x0160  #LATIN CAPITAL LETTER S WITH CARON
0x8B    0x2039  #SINGLE LEFT-POINTING ANGLE QUOTATION MARK
0x8C    0x0152  #LATIN CAPITAL LIGATURE OE
0x8D            #UNDEFINED
0x8E            #UNDEFINED
0x8F            #UNDEFINED
0x90            #UNDEFINED
0x91    0x2018  #LEFT SINGLE QUOTATION MARK
0x92    0x2019  #RIGHT SINGLE QUOTATION MARK
0x93    0x201C  #LEFT DOUBLE QUOTATION MARK
0x94    0x201D  #RIGHT DOUBLE QUOTATION MARK
0x95    0x2022  #BULLET
0x96    0x2013  #EN DASH
0x97    0x2014  #EM DASH
0x98    0x02DC  #SMALL TILDE
0x99    0x2122  #TRADE MARK SIGN
0x9A    0x0161  #LATIN SMALL LETTER S WITH CARON
0x9B    0x203A  #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
0x9C    0x0153  #LATIN SMALL LIGATURE OE
0x9D            #UNDEFINED
0x9E            #UNDEFINED
0x9F    0x0178  #LATIN CAPITAL LETTER Y WITH DIAERESIS

-- 
Gisle Aas


------------------------------

Date: Fri, 19 Mar 1999 04:37:53 -0500
From: ehpoole@ingress.com (Ethan H. Poole)
Subject: Re: URL Decoding???
Message-Id: <h84fpwec#GA.120@rejz.ij.net>

[Posted and Emailed]  In article <7csmup$3js$1@nnrp1.dejanews.com>, 
jas237@superlink.net says...
>
>Can anyone help me out.  I am new at Perl programming.  I'm having problems
>creating a decoding routine for a script that I'm writing.  I can get the
>script to work with POST but I can't get it working with GET.  I have tried 
a
>few different things that I have found in a few books but I always get a
>message that it is returning an empty document.  Any suggestions would be
>greatly appreciated!!!

>   if ($line =~ /$contents{'keyword'}/gi)

Where is the code that creates the $contents{...} hash?

Note: The code that parses CGI input will need to read from the QUERY_STRING 
environment variable for GET requests and from the STDIN filehandle for POST 
requests.

-- 
Ethan H. Poole              | Website Design and Hosting,
                            | CGI Programming (Perl & C)..
========Personal=========== | ============================
* ehpoole @ ingress . com * | --Interact2Day, Inc.--
                            | http://www.interact2day.com/



------------------------------

Date: 19 Mar 1999 10:36:53 +0100
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: Variables in QUERY_STRING
Message-Id: <83pv65vn0q.fsf@vcpc.univie.ac.at>

Re: Variables in QUERY_STRING, Jerome
<jeromeo@atrieva.com> said:

Jerome> I can't speak for Tony or Tad, but I make my
Jerome> living writing Perl, mostly for CGI based
Jerome> applications, and enjoy helping people with
Jerome> problems.

I worked at an ISP '94 - '96 basically doing
perl/CGI every day (look at the acknowledgements
section of CGI.pm :-).  I used to read and post help
to c.i.w.a.cgi but gave up on it in abject
frustration.  Sometimes I get the feeling c.l.p.misc
is going the same way.

(Or perhaps I'm just a pedantic old fart :-)

tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


------------------------------

Date: Fri, 19 Mar 1999 11:24:18 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: || vs "or"
Message-Id: <36f3333e.148321745@thunder>

On Thu, 18 Mar 1999 14:41:02 -0500, David Coppit
<dwc3q@mamba.cs.Virginia.EDU> enlightened us thusly:

>
>Why does the following print "1,"? I thought they were equivalent except
>for precedence, and it doesn't seem like precedence is a factor here.
>
>---------------------------
>$a = '' || 1;
>$b = '' or 2;
>
>print "$a,$b\n";
>---------------------------

Precedence IS an issue - 'or' is less important than '='.  Your code
can be rewritten as:

$a = ( '' || 1 );
( $b = '' ) or 2;
 ...

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5174
**************************************

home help back first fref pref prev next nref lref last post