[7576] in Perl-Users-Digest
Perl-Users Digest, Issue: 1202 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 20 21:07:16 1997
Date: Mon, 20 Oct 97 18:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 20 Oct 1997 Volume: 8 Number: 1202
Today's topics:
Re: Blank Space occurs after Search and Replace (Andrew M. Langmead)
Re: Blank Space occurs after Search and Replace (Eric Bohlman)
Calling an executable file from within Perl <girardj@primenet.com>
Constants and statics <joegottman@worldnet.att.net>
Handling EBCDIC Packed Decimal on ASCII Platform <tom.gebhardt@hboc.com>
Re: Help: sybperl 2.08 with RedHat 4.2 <jmillar@eaglequest.com>
Re: How do I collect email address using perl? (Faust Gertz)
Re: How do I match the first word in a string? <nnyxcu@ny.ubs.com>
Huge files, <>, and sysread() <delabeau@iniki.gsfc.nasa.gov>
Re: Huge files, <>, and sysread() (Jason Gloudon)
Re: Huge files, <>, and sysread() (Andrew M. Langmead)
Re: interprocess communcation for Win32 (John L. Daschbach)
Is there POSIX.pm for Perl Win32? (Binh Do)
Re: map or for : which is better in this case? <jholzman@fas.harvard.edu>
Re: map or for : which is better in this case? <jholzman@fas.harvard.edu>
Re: map or for : which is better in this case? <jholzman@fas.harvard.edu>
Perl and MS Excel <swarsi@nmpnet.net>
Perl for Windows NT <fcrutch@ami.net>
Re: Perl for Windows NT <nihonjin@cyberdude.com>
Re: Perl for Windows NT (Faust Gertz)
Re: Q: How to setup a default argument in a function? (William Reardon)
Re: Q: How to setup a default argument in a function? <rpsavage@ozemail.com.au>
Regular Expressions and Record Separators <bufic@cs.rpi.edu>
Re: setuid not changing uid (Scott Smith)
Threads (David J Meyer)
Re: Threads (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: What do I need for Oraperl? (John D Groenveld)
Re: Why this behaviour with complex data structure? (Eric Bohlman)
Re: Windoze question.. <ase@seanet.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 20 Oct 1997 20:28:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Blank Space occurs after Search and Replace
Message-Id: <EIDA6x.1Jx@world.std.com>
Bob Maillet <bobm@tiac.net> writes:
>In the script below, after the first line is writtine to the file each
>remaining line starts with a blank space..Is there any way to eliminate
>the blank space at the beginning of these lines?
> print MILE "@file";
When you put an array in a double quoted string, perl separates each
element with space (by default, ut separates it with the contents of
the $" variable, which is a space by default.)
The print function takes a list as an argument, so you can just say:
print MFILE @file;
and output all of the elements of @file, and since it is not
interpolated into a string, you will not get the $" separator.
--
Andrew Langmead
------------------------------
Date: Tue, 21 Oct 1997 00:20:37 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Blank Space occurs after Search and Replace
Message-Id: <ebohlmanEIDKyE.3v@netcom.com>
Bob Maillet (bobm@tiac.net) wrote:
: In the script below, after the first line is writtine to the file each
: remaining line starts with a blank space..Is there any way to eliminate
: the blank space at the beginning of these lines? I am opening the file
: twice because the search & replace is going to be part of an if
: statement if this is a new text file.
I can't see what's causing the blank space, but there are a couple
obvious problems with your script:
: $mcat = "C:/Perl/minorcat.txt";
: open (FILE, $mcat);
*ALWAYS* check to see if your open was successful!
: @file = <FILE>;
: close(FILE);
: foreach (@file){
: $_ =~ s/^\"//;
: $_ =~ s/\"\n$/\n/;
Note that you can omit the "$_ =~ ", since the s operator operates on $_
by default.
The next three statements are going to be executed for each entry in your
array (i.e. the entire file gets written after the quotes are stripped
from the first line, then after the second line, ad infinitum); they
really should be moved outside the foreach loop.
: open (MILE, ">$mcat");
You didn't check success here.
: print MILE "@file";
: close(MILE);
And you didn't check success here either.
: }
------------------------------
Date: 20 Oct 1997 16:43:01 -0700
From: "Jeff Girard" <girardj@primenet.com>
Subject: Calling an executable file from within Perl
Message-Id: <01bcddb1$f9479860$78da1b8a@girardj.army.mil>
Im using Perl ver 5 on an NT 4.0 platform. I need to call and execute an
executable from within perl. The file will execute but will not return a
value to perl.
Example:
I want to call a freeware executable called zip from within perl.
Command line syntax:
zip target source1 source2 source3
Can anybody help me with the syntax to make this call from within Perl?
Jeff
------------------------------
Date: Mon, 20 Oct 1997 20:44:54 -0400
From: Joe Gottman <joegottman@worldnet.att.net>
Subject: Constants and statics
Message-Id: <62gu6b$r33@bgtnsc02.worldnet.att.net>
As long as they are putting new syntax elements into Perl, how about
constant
and static variables. I know of 2 ways of doing constants in Perl, and
both have
disadvantages. The first way,
*PI = \3.1415;
does not work for a variable declared with my, or for a hash or array.
The second
way,
sub PI() {3.1415;}
cannot be declared either local or my.
Static variables are possible, but tedious. Why not steal the syntax
for static,
constant (and volatile while we're at it) from C?
--
Joe Gottman
joegottman@nospam.worldnet.att.net
[Remove nospam to reply]
------------------------------
Date: 20 Oct 1997 20:46:56 GMT
From: "Tom Gebhardt" <tom.gebhardt@hboc.com>
Subject: Handling EBCDIC Packed Decimal on ASCII Platform
Message-Id: <01bcdd99$4cc4c530$34161595@tgebhardt>
Has anyone had any experience converting EBCDIC Packed Decimal fields to
usable numerics when reading a file from an ASCII-platform Perl script?
I'm having some trouble figuring out how to use the unpack or vec functions
to do this. Are these functions even the correct approach?
------------------------------
Date: Mon, 20 Oct 1997 20:11:07 -0400
From: "Jay T. Millar" <jmillar@eaglequest.com>
Subject: Re: Help: sybperl 2.08 with RedHat 4.2
Message-Id: <344BF31B.29227@eaglequest.com>
Jeffrey Yu wrote:
>
> I tried to compile the sybperl 2.08 CTlib in RedHat 4.2, I got
> a lot of "undefined reference to ' ' " errors. I have tried almost
> everything I can think of, but nothing seems to work so far.
> If anyone knows the answer to solve the problem, please
> share it with us, I believe over time there will be more and
> more people look into this tool. And an effective solution
> can save a lot of time. Thanks in advance.
>
> --Jeff
Hi Jeff,
Just went through the exact same hassle. Basically there are two things
that you need to do:
1. Compile the sybperl module as a *static* module so that a whole new
perl binary is created. Creating a dynamically loadable sybperl module
under Linux with ctlib will not work (from what I know). This
compilation method is controlled by the last variable defined in the
CONFIG file for sybperl (LINKTYPE=STATIC)
2. In the directory where you have the ctlib libraries installed (mine
are in /opt/sybase/lib), make a copy of the libsybtcl.a library and name
it libtcl.a
Once this is configured, compile sybperl and you'll get a new perl
binary with the appropriate ctlib libraries statically linked. Works
like a champ. Very, very cool.
I owe the sybperl mailing list for this information.
Jay Millar
jmillar@eaglequest.com
------------------------------
Date: Mon, 20 Oct 1997 21:06:42 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: How do I collect email address using perl?
Message-Id: <344bc550.4543835@news.wwa.com>
On 18 Oct 1997 15:40:06 GMT, 56160@udel.edu (guess) wrote:
>This is for a school project.
>Your help is greatly appreciated.
Today, more than most days, 'September' abounds.
Instead of yelling at you or giving you a worthless script, I'll give
you an e-mail address for your collection. Ask Clifton Sharp
<clifto@megsinet.net> about the method of e-mail address collecting he
uses for his signature, which often reads something like:
: --
: +---------------------------------------------------------------------------+
: | Cliff Sharp | email@address.dom is an address I saw today. |
: | WA9PDM | |
: +---------------------------------------------------------------------------+
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"Even the gods, for all they are called wise, are no more to be
trusted than fleeting dreams. Among the gods, no less than mortal
men, confusion reigns." -- Orestes, _Iphigenia in Taurus_
------------------------------
Date: Mon, 20 Oct 1997 18:22:04 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
To: Brian Kendig <bskendig@netcom.com>
Subject: Re: How do I match the first word in a string?
Message-Id: <344BD98C.49D@ny.ubs.com>
Brian Kendig wrote:
>
> This should be simple, but it's got me stumped. I'm trying to assign
> the first word of a string to a variable, but it's not working. This code:
>
> $foo = "Hi There";
> ($foo) =~ /^(\w+)/;
asks: "Does $foo begin with one or more alpha-numberics?"
answer: Yes.
> print "$foo\n";
>
> outputs "Hi There" instead of "Hi". I've also tried these, individually:
>
> $foo =~ /^(\w+)/;
Same question.
Same answer.
> ($foo) =~ /^([^ ]+)/;
Asks: "Does $foo begin with one or more characters that are not
spaces?"
Answer: Yes.
> $foo ~= s/^(\w+)/\1/;
Ah, much closer (except for the syntax error: =~ not ~=).
Says: Substitute in $foo all of the alphanumerics at the beginning
with themselves;
i.e., substitute "Hi" with "Hi";
All you need is something to match the tail of the string for the
substitution:
$foo =~ s/^(\w+).*/\1/;
>
> But, no luck with any of them; $foo remains unchanged. What am I doing
> wrong?
>
Part of the problem may be the way you posed the question. "Match(ing)
the first word in a string" wasn't your problem--you did that just fine,
in all your attempts. Posing the question as "assign(ing) the first
word of a string to a variable" is closer to what you seem to want, but
would lead more naturally to a solution like:
$string =~ /^(\w+)/;
$foo = $1;
Thinking about it as "stripping all but the first word from a string"
might have lead you to the solution.
> --
> _/_/_/ Be insatiably curious. Je ne suis fait comme aucun
> /_/_/ Ask "why" a lot. de ceux que j'ai vus; j'ose croire
> _/_/ n'etre fait comme aucun de ceux qui existent.
> / Brian Kendig Si je ne vaux pas mieux, au moins je suis autre.
> / bskendig@netcom.com -- Rousseau
> http://people.netscape.com/brian/
------------------------------
Date: 20 Oct 1997 16:31:08 -0400
From: J-F Pitot de La Beaujardiere <delabeau@iniki.gsfc.nasa.gov>
Subject: Huge files, <>, and sysread()
Message-Id: <yf1hgac6usz.fsf@iniki.gsfc.nasa.gov>
A colleague just came to me with a Perl problem. He is attempting to read a
huge (20MB) text file. Everything works if he attempts to process test
lines snipped from the file, but if he tries to process the entire file it
takes forever (forever = longer than patience permits). Stepping through
with the debugger suggests that the line
foreach $line (<FILE>)
which begins his processing loop is what is slow, as if <FILE> must read
everything before handling the first line. I suggested using sysread(),
which worked for his fixed-record-length file, but that would be less
convenient with variable-length records.
Now I am curious. I could not find answers to the following questions
by RTFM:
(1) Does <FILE> really read everything before starting the loop?
Does it depend on the OS?
(2) Is there an alternative to <FILE> and sysread()?
(a Perl-only alternative, that is; I wouldn't want to split(1) and
a long file and process each piece).
(3) Is there an equivalent to $| to somehow unbuffer the input?
--Jeff
= J-F Pitot de La Beaujardiere delabeau@iniki.gsfc.nasa.gov =
= U. Maryland and NASA Goddard http://globe2.gsfc.nasa.gov/ =
------------------------------
Date: 20 Oct 1997 23:37:42 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Huge files, <>, and sysread()
Message-Id: <62gq06$t2a$1@daily.bbnplanet.com>
J-F Pitot de La Beaujardiere (delabeau@iniki.gsfc.nasa.gov) wrote:
: A colleague just came to me with a Perl problem. He is attempting to read a
: huge (20MB) text file. Everything works if he attempts to process test
: lines snipped from the file, but if he tries to process the entire file it
: takes forever (forever = longer than patience permits). Stepping through
: with the debugger suggests that the line
: foreach $line (<FILE>)
: which begins his processing loop is what is slow, as if <FILE> must read
: everything before handling the first line. I suggested using sysread(),
: which worked for his fixed-record-length file, but that would be less
: convenient with variable-length records.
: Now I am curious. I could not find answers to the following questions
: by RTFM:
: (1) Does <FILE> really read everything before starting the loop?
: Does it depend on the OS?
Are you sure you read perlop ?
If a <FILEHANDLE> is used in a context that is looking for
a list, a list consisting of all the input lines is
returned, one line per list element. It's easy to make a
LARGE data space this way, so use with care.
: (2) Is there an alternative to <FILE> and sysread()?
: (a Perl-only alternative, that is; I wouldn't want to split(1) and
: a long file and process each piece).
while (<FILE>){
process $_;
}
: (3) Is there an equivalent to $| to somehow unbuffer the input?
No.
Jason Gloudon
------------------------------
Date: Mon, 20 Oct 1997 23:32:53 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Huge files, <>, and sysread()
Message-Id: <EIDIqt.Bw6@world.std.com>
J-F Pitot de La Beaujardiere <delabeau@iniki.gsfc.nasa.gov> writes:
> foreach $line (<FILE>)
The foreach loop loops over a list, that means that the arugment
inside the parens is evaluated in a list context. The readline
operator in a list context returns all the remaining lines in the
file. What you are doing is similar to:
@lines = <FILE>; # fill @lines with the contents of FILE.
foreach $line (@lines)
>(1) Does <FILE> really read everything before starting the loop?
> Does it depend on the OS?
No, it depends on whether it is called in an array or list context.
>(2) Is there an alternative to <FILE> and sysread()?
> (a Perl-only alternative, that is; I wouldn't want to split(1) and
> a long file and process each piece).
Use while, a looping construct that calls the readline operator <> in
a scalar context.
while( defined( $line = <FILE> ) )
This will read one line into $line, and check if it is the end of file
or not. If it isn't the contents of the loop will be executed.
--
Andrew Langmead
------------------------------
Date: 20 Oct 1997 12:48:19 -0700
From: d3h486@wd19518.emsl.pnl.gov (John L. Daschbach)
Subject: Re: interprocess communcation for Win32
Message-Id: <m3k9f8usfw.fsf@wd19518.emsl.pnl.gov>
gerlach@netcom.com (Matthew H. Gerlach) writes:
> >I am a new perl5.0 User. I am trying to do the following things:
> >
> >1:launch a perl program
> >2:create a child process
> >3: communicate between the parent and the child process.
> >
> >how do I achieve this? I tried to use chat2.pl but it doesn't work in
> >win32 because the "fork" doesn't work. Is there anyone who can help me?
> >thanks in advance.
> >
> >jianhua
> This is a fairly complicated thing to implement. Under Unix this is
> usually done with pseudo-ttys. I hear Expect has been ported to winNT.
> It doesn't use pseudo-ttys, but it is supposed to be able to talk to
> other programs.
If you are creating the child yourself (i.e. you wrote it) it's pretty
easy to do, depending on your machine. Of course if you can't fork()
you can't create a child!
I don't know anything (much) about W32, but it at least does sockets.
I have a instrument control application written by someone else in VB,
and I talk to it over sockets from OS/2 Linux, Irix, and AIX using Perl.
On a single machine I ususally use the somewhat standard IPC routines,
generally messages if my communication needs are low.
You will have to have your processes agree on socket numbers or
message que id's if you can't fork, but that's just bookkeeping.
-John
------------------------------
Date: Tue, 21 Oct 1997 00:40:06 GMT
From: bdo@epnet.com (Binh Do)
Subject: Is there POSIX.pm for Perl Win32?
Message-Id: <344bf924.28711755@newshost>
I installed Perl-Win32 for NT (latest version 5.003) and do not see POSIX.pm in the lib
directory. So I am not sure if POSIX.pm is not ported yet or should I get it somewhere and
install it manually?
Thank you for any info.
Binh.
------------------------------
Date: Mon, 20 Oct 1997 18:44:54 -0400
From: Joanna Holzman <jholzman@fas.harvard.edu>
To: brian moseley <brian@criticalpath.net>
Subject: Re: map or for : which is better in this case?
Message-Id: <344BDEE6.2A7D5E2A@fas.harvard.edu>
brian moseley wrote:
>
> ok. $list is a reference to an array of objects( which respond to a
> header() method) and $hdr is a string; both $list and $hdr have been
> passed into this particular sub.
>
> i want to create a hash with key "value of this object's $hdr header"
> and value "index of this object in @$list", such that i can create
>
> @sorted_table = sort keys %table;
>
> and then build a new sorted array of objects.
>
> which of the below pieces of code is preferable, in terms of speed,
> readability, and overall niceness?
>
> candidate 1:
>
> my %table;
> for ( my $idx = 0; $idx < ( scalar @$list ); $idx++ ) {
> my $val = $list->[$idx]->header( $hdr );
> $table{$val} = $idx;
> }
>
> candidate 2:
>
> my $idx = 0;
> my %table = map {
> $_->header( $hdr ), $idx++
> } @$list;
>
First, in number 1, you don't need the '(scalar @$list)'; just '@$list'
will do fine in that instance. As to which candidate is "better", that
probably depends on who will be maintaining it. If it will be a c
programmer, then number 1 would make more sense; if a lisp programmer,
number 2. However, in either case, I'm curious why you're copying
everything in to a hash, when you should probably just use a schwartzian
transform:
my @sortedlist = map {$_->[1]}
sort {$_->[0] cmp $_->[0]}
map {[$_->header($hdr), $_]}
@$list;
This will be easily maintainable by a perl programmer ;-)
> --
>
> * brian moseley *
> { agent of chaos => critical path }
------------------------------
Date: Mon, 20 Oct 1997 18:43:50 -0400
From: Joanna Holzman <jholzman@fas.harvard.edu>
To: brian moseley <brian@criticalpath.net>
Subject: Re: map or for : which is better in this case?
Message-Id: <344BDEA6.B9EC072@fas.harvard.edu>
brian moseley wrote:
>
> ok. $list is a reference to an array of objects( which respond to a
> header() method) and $hdr is a string; both $list and $hdr have been
> passed into this particular sub.
>
> i want to create a hash with key "value of this object's $hdr header"
> and value "index of this object in @$list", such that i can create
>
> @sorted_table = sort keys %table;
>
> and then build a new sorted array of objects.
>
> which of the below pieces of code is preferable, in terms of speed,
> readability, and overall niceness?
>
> candidate 1:
>
> my %table;
> for ( my $idx = 0; $idx < ( scalar @$list ); $idx++ ) {
> my $val = $list->[$idx]->header( $hdr );
> $table{$val} = $idx;
> }
>
> candidate 2:
>
> my $idx = 0;
> my %table = map {
> $_->header( $hdr ), $idx++
> } @$list;
>
First, in number 1, you don't need the '(scalar @$list)'; just '@$list'
will do fine in that instance. As to which candidate is "better", that
probably depends on who will be maintaining it. If it will be a c
programmer, then number 1 would make more sense; if a lisp programmer,
number 2. However, in either case, I'm curious why you're copying
everything in to a hash, when you should probably just use a schwartzian
transform:
my @sortedlist = map {$_->[1]}
sort {$_->[0] cmp $_->[0]}
map {[$_->header($hdr), $_]}
@$list;
This will be easily maintainable by a perl programmer ;-)
> --
>
> * brian moseley *
> { agent of chaos => critical path }
------------------------------
Date: Mon, 20 Oct 1997 18:45:08 -0400
From: Joanna Holzman <jholzman@fas.harvard.edu>
To: brian moseley <brian@criticalpath.net>
Subject: Re: map or for : which is better in this case?
Message-Id: <344BDEF4.F8873637@fas.harvard.edu>
brian moseley wrote:
>
> ok. $list is a reference to an array of objects( which respond to a
> header() method) and $hdr is a string; both $list and $hdr have been
> passed into this particular sub.
>
> i want to create a hash with key "value of this object's $hdr header"
> and value "index of this object in @$list", such that i can create
>
> @sorted_table = sort keys %table;
>
> and then build a new sorted array of objects.
>
> which of the below pieces of code is preferable, in terms of speed,
> readability, and overall niceness?
>
> candidate 1:
>
> my %table;
> for ( my $idx = 0; $idx < ( scalar @$list ); $idx++ ) {
> my $val = $list->[$idx]->header( $hdr );
> $table{$val} = $idx;
> }
>
> candidate 2:
>
> my $idx = 0;
> my %table = map {
> $_->header( $hdr ), $idx++
> } @$list;
>
First, in number 1, you don't need the '(scalar @$list)'; just '@$list'
will do fine in that instance. As to which candidate is "better", that
probably depends on who will be maintaining it. If it will be a c
programmer, then number 1 would make more sense; if a lisp programmer,
number 2. However, in either case, I'm curious why you're copying
everything in to a hash, when you should probably just use a schwartzian
transform:
my @sortedlist = map {$_->[1]}
sort {$_->[0] cmp $_->[0]}
map {[$_->header($hdr), $_]}
@$list;
This will be easily maintainable by a perl programmer ;-)
Benjamin Holzman
> --
>
> * brian moseley *
> { agent of chaos => critical path }
------------------------------
Date: Mon, 20 Oct 1997 17:27:36 -0400
From: Suhail Warsi <swarsi@nmpnet.net>
Subject: Perl and MS Excel
Message-Id: <344BCCC8.E16B7C8@nmpnet.net>
Does any one know if there is anything for perl that allows it to access
MS Excel files?
Suhail
------------------------------
Date: 20 Oct 97 22:56:31 GMT
From: "AAMU" <fcrutch@ami.net>
Subject: Perl for Windows NT
Message-Id: <01bdfaed$8fbc7e10$92c28bcd@michelangelo>
Hi,
Does anybody know where I can download Perl for Windows NT 4.0
(workstation)?
Thanks for your assistance,
aamu
------------------------------
Date: Tue, 21 Oct 1997 02:09:21 +0100
From: "A.K" <nihonjin@cyberdude.com>
Subject: Re: Perl for Windows NT
Message-Id: <344C00C1.7725DE16@cyberdude.com>
Tell me when you find it I'm looking for the same thing!
Thanx!
AAMU wrote:
> Hi,
>
> Does anybody know where I can download Perl for Windows NT 4.0
> (workstation)?
>
> Thanks for your assistance,
> aamu
------------------------------
Date: Tue, 21 Oct 1997 00:38:00 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Perl for Windows NT
Message-Id: <344bf4f0.16573289@news.wwa.com>
On 20 Oct 97 22:56:31 GMT, "AAMU" <fcrutch@ami.net> wrote:
>Does anybody know where I can download Perl for Windows NT 4.0
>(workstation)?
People who can read FAQs know. From
http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ_1.html
:1.4. Where is the Perl for Win32 interpreter available?
:
:The Perl for Win32 package is available as a ZIP archive by anonymous FTP from ActiveWare and from CPAN, the
:Comprehensive Perl Archive Network.
:
:To download from ActiveWare, look in this directory:
:
:ftp://ftp.ActiveState.com/Perl-Win32/Release/
:
:There are 4 distribution packages: one for Intel x86 machines, one for DEC Alpha machines, one for PowerPC machines, and one
:source code package. These packages are named XXX-i86.zip, XXX-Alp.zip, XXX-Ppc.zip, and XXX-src.zip, respectively, where
:XXX is the current build number. The current build number is 110.
:
:To download files from CPAN, go to the following URL:
:
:http://www.perl.com/CPAN-local/ports/nt/
:
:Note that this will automatically redirect you to your nearest CPAN mirror site.
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: Mon, 20 Oct 1997 21:28:16 GMT
From: wdr1@cs.uchicago.edu (William Reardon)
Subject: Re: Q: How to setup a default argument in a function?
Message-Id: <EIDCz4.85D@midway.uchicago.edu>
In article <344069E8.4807@dnaco.net>, Eric Heft <eheft@dnaco.net> wrote:
> What I want to do is have a function that takes a variable number of
>arguments.
>If an argument is not passed, I'll like to set a specific value to it.
>For example
>the following function rnd might be called as:
>
>rnd(1,6);
>rnd(2,10);
>rnd(1,10,6);
>
>The function works but with the strict checking turned on, complains
>that cnt has
>not been initialized on line number 10, when called as rnd(1,6). It
>doesn't complain
>(of course) when called as rnd(1,6,0).
>
> 1: #! /usr/bin/perl5 -w
> 2:
> 3: use strict;
> 4:
> 5: sub rnd
> 6: {
> 7: my ($numDie,$die,$cnt) = @_;
> 8: while ($numDie > 0)
> 9: {
>10: $cnt = $cnt + sprintf("%d",rand($die)+1);
>11: $numDie --;
>12: }
>13: return ($cnt);
>14: }
Between 7 & 8 you can do something like:
$cnt ||= 0; #(where 0 is what the default should be)
Don't know if it will take care of the strict warning, but it's what
I've to handle default settings.
-Bill
--
William Reardon wdr1@nhma.com
An oak tree is just a nut that held it's ground.
------------------------------
Date: Tue, 21 Oct 1997 09:08:45 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Q: How to setup a default argument in a function?
Message-Id: <344BD66D.2DC@ozemail.com.au>
[snip]
Actually, you can supply default values for parameters...
sub marine
{
push(@_, 0) if ($#_ == 0); # Default for $print is 0.
my($self, $print) = @_;
}
--
Cheers,
Ron Savage
Office: savage.ron.rs@bhp.com.au
Home (preferred): rpsavage@ozemail.com.au
------------------------------
Date: Mon, 20 Oct 1997 17:45:34 -0400
From: Corey Bufi <bufic@cs.rpi.edu>
Subject: Regular Expressions and Record Separators
Message-Id: <344BD0FD.101C7E@cs.rpi.edu>
I want to set the input record separator to a regurlar expression
so that a file can be segmented according to any one of a set of
multi-character delimiters. For example, I want to set the
delimiting condition to be case insensitive. From what I gather,
this can't be done. Is this correct?
Thanks,
Corey
------------------------------
Date: 20 Oct 1997 21:15:00 GMT
From: scottsmi@blue.seas.upenn.edu (Scott Smith)
Subject: Re: setuid not changing uid
Message-Id: <SCOTTSMI.97Oct20171500@blue.seas.upenn.edu>
I wrote earlier <SCOTTSMI.97Oct19161658@blue.seas.upenn.edu>
> When I try running a setuid perl script, it runs as the user invoking
> the script.
I should have added that I am using perl5.003, whichever version was
included with Redhat Linux/Intel 4.0. The question is, is there
something I should check for a wrong setup (both the script and suidperl
seem to have the right permissions) or is this a bug in what I had
installed.
Thanks,
Scott Smith
------------------------------
Date: Mon, 20 Oct 1997 17:35:35 -0700
From: dmeyer9@ix.netcom.com (David J Meyer)
Subject: Threads
Message-Id: <dmeyer9-2010971735350001@atl-ga10-02.ix.netcom.com>
Does perl have any way to multi-thread, either
at a perl or OS level?
How is this done, if it is available.
David Meyer
------------------------------
Date: Mon, 20 Oct 97 19:03:41 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Threads
Message-Id: <344be383$1$ofn$mr2ice@speaker>
In <dmeyer9-2010971735350001@atl-ga10-02.ix.netcom.com>, on 10/20/97 at 05:35
PM,
dmeyer9@ix.netcom.com (David J Meyer) said:
+-----
| Does perl have any way to multi-thread, either
| at a perl or OS level?
+--->8
Not yet: Perl's core is not MT-safe. But stay tuned to www.perl.com; a
multithreaded Perl is in development.
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
Memo to MLS: End The Burn Scam --- Doug Logan MUST GO! FORZA CREW!
------------------------------
Date: 20 Oct 1997 16:14:45 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: What do I need for Oraperl?
Message-Id: <62ge3l$b38$1@tholian.cse.psu.edu>
In article <628lbt$78u@camel20.mindspring.com>,
Lennie Jarratt <lbj_ccsi@atl.mindspring.com> wrote:
>to grab and install. I already have Perl 5.003 running. I got
>oraperl v2.4. Is this the correct version or is there something else
>I should be using?
>Should I use the DBD and DBI modules instead and not Oraperl?
The path to enlightenment is http://www.dejanews.com/. Use the query
"oraperl AND ~g comp.lang.perl.*" and check the old archive.
BTW comp.databases.oracle is dead, you should ask your news admin to
carry the new comp.databases.oracle.* heirarchy.
John
groenvel@cse.psu.edu
------------------------------
Date: Mon, 20 Oct 1997 18:24:55 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Why this behaviour with complex data structure?
Message-Id: <ebohlmanEID4HJ.K7H@netcom.com>
Robert Telka (telka@nortel.ca) wrote:
: # Print all the key:value pairs our hash contains... and observe the
: # problem I've run across...
: foreach $key (%hash)
This actually "flattens out" %hash so that it looks like an array of
key1,value1,key2,value2, etc. What you really want is:
foreach $key (keys %hash)
which iterates over the keys only.
------------------------------
Date: Mon, 20 Oct 1997 17:32:40 -0700
From: "Allen Evenson" <ase@seanet.com>
Subject: Re: Windoze question..
Message-Id: <62gt6f$9t3@q.seanet.com>
=20
Janne Lepp=E4nen wrote in article <62fgm0$tvq$3@bambu.metla.fi>...
>Does anyone know can I automate installation of printer drivers with =
perl?
You might try the Win32::API module which like the name suggests allows =
you to do any API calls.
>Can I handle program groups with it? (the startup-folder for example)
The startup folder is just a directory: (C:\Win95\"Start =
Menu"\Programs\Startup) on my machine, that contains shortcuts. (I =
think theres a module to create those too)
>Can I automate installation of stupid programs like Netscape,Acrobat =
viewer
>somehow?
>
Don't know about this... Maybe use perl to read the Install scripts of =
the app and
have perl do the actual work instead of the installer
------------------------------------------------------
Allen Evenson ase@seanospamnet.com (remove "nospam" to use)
....Learning Perl, one script at a time...
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
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 1202
**************************************