[11840] in Perl-Users-Digest
Perl-Users Digest, Issue: 5440 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 21 12:07:31 1999
Date: Wed, 21 Apr 99 09:00:20 -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 Wed, 21 Apr 1999 Volume: 8 Number: 5440
Today's topics:
Re: Any visual editor for Perl: Win32? (Daniel Beckham)
Re: Books (Richard J. Rauenzahn)
Re: CGI programmer wanted <jeromeo@atrieva.com>
Re: EOF on pipe (M.J.T. Guy)
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? (Kevin Reid)
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <gellyfish@gellyfish.com>
Re: Help! CGI::Cookie script works fine, but problem wh <jacks@cybersource.com>
Re: How to determine if a specified disk drive exists <gellyfish@gellyfish.com>
Re: How to determine if a specified disk drive exists (Larry Rosler)
Re: html-to-txt <gellyfish@gellyfish.com>
Re: html-to-txt (Steve Linberg)
Re: ifeither--How about some feedback? (Steve Linberg)
Re: interesting hash problem (Kevin Reid)
Re: invoking by "fire and forget" jboes@my-dejanews.com
Re: Is it possible to "reset" the ?? pattern search? <tchrist@mox.perl.com>
Re: Is it possible to "reset" the ?? pattern search? (Abigail)
Re: JPL: JNI Panic on 3rd call returning String[] kucerar@hhmi.org
Re: JPL: JNI Panic on 3rd call returning String[] kucerar@hhmi.org
Re: Perl fo win95 (Daniel Beckham)
Re: Permissions for Directory (J.D. Silvester)
Re: Q: perl process won't go away (Daniel Beckham)
Re: Random number generator (Abigail)
Re: Random number generator <Michael.Cameron@no.spam.technologist.com>
Re: Random value for Scalar <Allan@due.net>
Re: Suggestions and oneliners for Perl-talk? (Abigail)
Re: Suggestions and oneliners for Perl-talk? (Abigail)
Re: Too many SIGCHLDs ? (Dan Wilga)
Re: Which cgi tool should i use ? (Tad McClellan)
Re: why are only certain bareword hash keys ambiguous? (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Apr 1999 09:52:59 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Any visual editor for Perl: Win32?
Message-Id: <MPG.1187a241bfab2fc79896b4@news.idt.net>
www.textpad.com, v4.0 is in beta and has syntax highlighting... v3 is
available now and works quite nicely. (but no syntax highlighting)
In article <01be8b6f$dfbe6460$4d96bad1@jdurkin>, jdurkin@gw.total-web.net
says...
> Hi,
>
> I'm a newbie to Perl. Any visual editor commonly used with Perl on windows
> NT?
>
> Also, can you guide me to any good websites that have network related Perl
> scripts?
>
> Thanks in advance,
>
> Jim Durkin
>
------------------------------
Date: 19 Apr 1999 17:44:34 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Books
Message-Id: <924543868.411987@hpvablab.cup.hp.com>
Ken Robbins <puyrebel@prodigy.net> writes:
>What are some other bookstores that are cheap. I know of
>barnesandnoble.com as well as borders.com, but any others?
Check out www.addall.com -- it will find the cheapest price on a book.
I personally use books.com (I refuse to do business with Amazon because
of their history of spamming). Books.com tends to be the cheap, and
will price match Barnes and Noble and Amazon (you have to click on the
compare prices link, though). The drawback is that they take a little
longer to ship.
According to www.addall.com the cheapest today is Fatbrain/Computer
Literacy for 3-7 day delivery at a total cost of 21.90 (including
shipping.)
Rich
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 46TU2
IASD / Enterprise Systems Group +--------------+---- Cupertino, CA 95014
------------------------------
Date: Wed, 21 Apr 1999 07:52:26 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: CGI programmer wanted
Message-Id: <371DE62A.6E579CA0@atrieva.com>
David Cassell wrote:
> Actually, there was a lot more, but the MIME-encoded nude pictures
> of Alyssa Milano and Pamela Anderson-Lee probably didn't show up
> on your newsreader. Although why he superimposed the Camel book into
> those pics is beyond me...
I'd wager beer that if Alyssa and Pam replaced Mr. Camel on the cover,
the book would be a best seller in a week.
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 21 Apr 1999 15:38:45 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: EOF on pipe
Message-Id: <7fkre5$58n$1@pegasus.csx.cam.ac.uk>
Scrobach Ura <scru@rdovira.lviv.ua> wrote:
>The following code will hung forever. The parent will wait for child to
>terminate and child will wait for input. As far as i know close on pipe
>will rise an EOF on pipe.
You have to close *all* the filehandles to the pipe to get an EOF.
But you still have CHLDSTDOUT still open in the child.
Put a close CHLDSTDOUT; between lines 10 and 11.
>[10] } else {
>[11] open STDIN, ">&CHLDSTDIN" or die "cannot dup: $!";
And that's an eccentric thing to do. Do you mean "<&CHLDSTDIN" ?
open() in perlfunc says
You may also, in the Bourne shell tradition, specify
an EXPR beginning with '>&', in which case the rest
of the string is interpreted as the name of a
filehandle (or file descriptor, if numeric) to be
duped and opened. You may use & after >, >>, <, +>,
>>>>>>>>>> +>>, and +<. The mode you specify should match the
>>>>>>>>>> mode of the original filehandle.
(Not that it generates any error, or seems to do any harm.)
Mike Guy
------------------------------
Date: Wed, 21 Apr 1999 10:54:03 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <1dqiacl.eusw8n1qh3jlaN@[192.168.0.1]>
Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
> with a proper toolbox on the so-called copmlete system that you
^^^^^^^^
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: 21 Apr 1999 16:11:51 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <371deab7@newsread3.dircon.co.uk>
Kevin Reid <kpreid@ibm.net> wrote:
> Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
>
>> with a proper toolbox on the so-called copmlete system that you
> ^^^^^^^^
Yeah I dont think the toolbox includes ispell ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 21 Apr 1999 09:02:52 -0700
From: Jack Schlotthauer <jacks@cybersource.com>
Subject: Re: Help! CGI::Cookie script works fine, but problem when using SSI's
Message-Id: <371DF6AC.A920345E@cybersource.com>
Why not <!--#exec cgi="/cgi-bin/test.cgi" -->
David Cassell wrote:
> Kevin Howe wrote:
> >
> > Hi, I have an extremely simple script which reads a cookie and then prints
> > it.
> > The script works fine when called from the script path ex:
> > http://...cgi-bin/test.cgi
> >
> > But it won't print when called from an SSI!
> > ex: <!--#INCLUDE virtual="/cgi-bin/test.cgi"-->
> >
> > I am at a total loss here, it must have something to do with CGI::Cookie,
> > but I can't say for sure.
> > Can anyone shed some light?
>
> The problem is unlikely to be with the program if it works properly
> when called from the command line.
>
> No, the problem is more likely with your server. Either it has not been
> set up right for SSI's, or it has not been told to recognize Perl
> scripts. So your problem is actually a job for a different newsgroup.
> One of the CGI newsgroups, or one specific to your webserver, would
> be better able to help you.
>
> Or you could read through the Perl FAQ and find a reference to some
> web/cgi/html documents that could help. This is nearly the first
> quesiton in perlfaq9. Or use 'perldoc -q' to search the FAQ for
> a helpful answer to your question: 'My CGI script runs from the
> command line but not the browser...'.
>
> HTH,
> David
> --
> David Cassell, OAO
> cassell@mail.cor.epa.gov
> Senior Computing Specialist phone: (541)
> 754-4468
> mathematical statistician fax: (541)
> 754-4716
--
Jack Schlotthauer 260-6174
jacks@cybersource.com
Webmaster BarberShop
http://barbershop.cybersource.com
------------------------------
Date: 21 Apr 1999 15:35:27 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to determine if a specified disk drive exists
Message-Id: <371de22f@newsread3.dircon.co.uk>
Vincent Vanbiervliet <vvb@ibm.net> wrote:
>
> 5 sub testdrive {
> 6 $drive=shift;
> 7 $dir="$drive:/";
> 8 opendir DIR, $dir or return "0"; # in theory you should do
> a 'or die...' Perl Guru's: please tell us if this is 'dangerous' or not...
> 9 return "1";
> 10 close DIR;
> 11 }
>
>
What you are doing is perfectly fine - in general what you want to do is
die after the failure to open a file or directory or whatever because
there is no point in carrying on - but in this case you are using the
failure to indicate some condition which is fine - you arent going on
and trying to do something with the dir handle regardless.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 21 Apr 1999 07:54:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to determine if a specified disk drive exists
Message-Id: <MPG.11878686c26f33c49898f5@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <371dd028@news.uk.ibm.net> on Wed, 21 Apr 1999 15:21:25
+0200, Vincent Vanbiervliet <vvb@ibm.net> says...
> Here's a small script that does the job.
> BUT! In this script I'm doing something that I shouldn't be doing: see line
> 8. But even if you use the -w switch, it doesn't give an error message...
> Basically: if there is an error in reading the directory (or the drive), I
> ignore the error and return false, otherwise, return true...
You are not ignoring the error. You are dealing with it in a specific
way.
...
> 8 opendir DIR, $dir or return "0"; # in theory you should do
> a 'or die...' Perl Guru's: please tell us if this is 'dangerous' or not...
> 9 return "1";
In what 'theory'? I think you misunderstand the purpose of the 'or die
...' idiom. It is to prevent the program from proceeding blindly, using
a filehandle that hasn't been opened successfully.
Dying is just one possible action to take if the open fails --
admittedly a very severe one. Your action is less severe, and quite
reasonable (except for the fact that you return strings instead of
numbers, for no good reason).
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 21 Apr 1999 15:02:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: html-to-txt
Message-Id: <371dda74@newsread3.dircon.co.uk>
Eduardo Catarino <empgc@ilusion.inesc.pt> wrote:
> Does anyone have some ideas how to build a html-to-txt converter?
>
I think the author of perlfaq9 does - check it out.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 21 Apr 1999 10:48:59 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: html-to-txt
Message-Id: <linberg-2104991048590001@ltl1.literacy.upenn.edu>
In article <371DB8AE.A4D6661D@ilusion.inesc.pt>, Eduardo Catarino
<empgc@ilusion.inesc.pt> wrote:
> Does anyone have some ideas how to build a html-to-txt converter?
If I were building one, I'd check the ones that are already built on CPAN
before I started.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 21 Apr 1999 10:45:50 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: ifeither--How about some feedback?
Message-Id: <linberg-2104991045500001@ltl1.literacy.upenn.edu>
In article <7K7S2.1159$hl6.48122@news.itd.umich.edu>,
mcafee@waits.facilities.med.umich.edu (Sean McAfee) wrote:
> print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
> q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
Completely OT, but that's the funniest JAPH I've seen in a long time! :)
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 21 Apr 1999 10:54:01 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: interesting hash problem
Message-Id: <1dqf6e6.1jcvnib1pjohfzN@[192.168.0.1]>
Soulier, Michael (EXCHANGE:SKY:1Z22) <msoulier@americasm01.nt.com>
wrote:
> Hey guys. I'm having an interesting confusion about hashes (well, it's
> interesting to me anyway). I was under the impression that I could add
> levels to a hash dynamically, all I wanted. For example, if I had:
>
> my %myHash = ();
>
> I could say
>
> $myHash{'key1'} = 1;
>
> Then, I could later say
>
> $myHash{'key1'}{'key2} = 1;
>
> And continue all I wanted. I've been doing this for a while and never
> run into a problem, until now.
The problem is that the value of $myHash{'key1'} is being treated as a
symbolic reference, resulting in
$myHash{'key1'}{'key2'} = 1;
actually referring to:
$1{'key2'} = 1;
So you are actually assigning to key 'key2' of the hash %1.
The solution is to either delete or undefine $myHash{'key1'} before
trying to treat it as a reference.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Wed, 21 Apr 1999 14:05:03 GMT
From: jboes@my-dejanews.com
Subject: Re: invoking by "fire and forget"
Message-Id: <7fkluc$235$1@nnrp1.dejanews.com>
In article <7ffqbm$md1$1@nnrp1.dejanews.com>,
e_broyles <e_broyles@yahoo.com> wrote:
> Does this mean that there is no way to get a child process that continues to
> run even if the parent process dies or stops intentionally?
Well, this is a kludge, and I don't have a setup which will support my testing
it, but:
* Determine the current clock time.
* Add a minute or two.
* Run the 'at' command to schedule the process you want to run.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 21 Apr 1999 08:29:38 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Is it possible to "reset" the ?? pattern search?
Message-Id: <371de0d2@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
rogdh@iname.com writes:
:I have a pattern search of ?GOTO? in a sub-routine.
:I open and close a different file each time I go in the sub.
:I want re-set the ?? search so that I can find the first GOTO of
:each file that I pass to the sub.
:Can I reset the ?? to an "initial"state each time I enter the sub?
% grep -l reset /usr/man/man1/perl*.1
....
/usr/man/man1/perlfunc.1
/usr/man/man1/perlsyn.1
....
% man perlsyn
...
Note that if there were a continue block on the above code, it would
get executed even on discarded lines. This is often used to reset
line counters or ?pat? one-time matches.
# inspired by :1,$g/fred/s//WILMA/
while (<>) {
?(fred)? && s//WILMA $1 WILMA/;
?(barney)? && s//BETTY $1 BETTY/;
?(homer)? && s//MARGE $1 MARGE/;
} continue {
print "$ARGV $.: $_";
close ARGV if eof(); # reset $.
reset if eof(); # reset ?pat?
}
--
Randal said it would be tough to do in sed. He didn't say he didn't
understand sed. Randal understands sed quite well. Which is why he
uses Perl. :-) -- Larry Wall in <7874@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 21 Apr 1999 14:38:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Is it possible to "reset" the ?? pattern search?
Message-Id: <7fknsc$4fd$1@client2.news.psi.net>
rogDH (rogdh@iname.com) wrote on MMLIX September MCMXCIII in
<URL:news:371ec6bd.34688088@news.earthlink.net>:
@@ I have a pattern search of ?GOTO? in a sub-routine.
@@ I open and close a different file each time I go in the sub.
@@ I want re-set the ?? search so that I can find the first GOTO of
@@ each file that I pass to the sub.
@@ Can I reset the ?? to an "initial"state each time I enter the sub?
Did you grep the documentation for reset?
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
------------------------------
Date: Wed, 21 Apr 1999 14:30:21 GMT
From: kucerar@hhmi.org
Subject: Re: JPL: JNI Panic on 3rd call returning String[]
Message-Id: <7fkndt$3n8$1@nnrp1.dejanews.com>
In article <371A009E.B7634593@home.com>,
Blair Wyman <bwymans@home.com> wrote:
> kucerar@hhmi.org wrote:
> >
> > Hello all who understand the workings of JPL:
>
> Not familiar with this -- Perl interconnectivity with Java? Cool!
>
Thanks for the info...seems like there'd be more interest in this.
Somebody with the luxury of time please produce the Perl platform
for me to use from Java.
TIA
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 21 Apr 1999 14:59:56 GMT
From: kucerar@hhmi.org
Subject: Re: JPL: JNI Panic on 3rd call returning String[]
Message-Id: <7fkp59$5cu$1@nnrp1.dejanews.com>
Briefly, I want to do quick, scalable calls to Perl code
to do quick one-off evals for text processing and/or networking or
other Perl junk that works, avoiding the hideous Java APIs
or third party classes which I have to go and get(and pay for)
I'd like to embed this stuff within JHTML on Java Web Server like
for example:
<java type=class>
static String theText = null;
</java>
<java>
/* GOODBYE PERL (FOR NOW)
String nowString = (new Date()).toString();
String perlScripts[] = {
"require \"flush.pl\"; open(H,\">temp.txt\"); print H \"hello world\n\";
flush(H);",
"require \"flush.pl\"; open(H,\">>temp.txt\"); print H \"append " +
nowString + "\n\"; flush(H);"
};
Perly.main( perlScripts );
String fullPath = "temp.txt";
String slurp[] = Perly.call( "$/='';open(H,\"<"+fullPath+"\");$_=<H>;[$_];" );
theText += slurp[ 0 ];
String it[] = Perly.call("[split(/LIVES/,\"it LIVES hehe...\")]");
for( int k=0; k < it.length; k++ ) theText += it[k];
*/
</java>
<html> ...
Getting a String[] back from any function (even without eval())
always dies on the 3rd try.
The flush()-ing required from the server hopelessly
encumbers the syntax also.
TIA
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 21 Apr 1999 10:05:15 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Perl fo win95
Message-Id: <MPG.1187a52a7b4bbef29896b5@news.idt.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
www.activestate.com
In article <fgbT2.233$h35.3286@newsfeed.slurp.net>, igdaudt@conex.com.br
says...
> Do you know where can I download full version of perl for win95?? I'd
> like to install that in my computer...
>
> Igor Daudt
> igdaudt@conex.com.br
>
>
>
------------------------------
Date: 21 Apr 1999 15:41:32 GMT
From: jsilves@julian.uwo.ca (J.D. Silvester)
Subject: Re: Permissions for Directory
Message-Id: <7fkrjc$grm@falcon.ccs.uwo.ca>
On Tue, 20 Apr 1999 23:23:57 GMT trevod@hotmail.com wrote:
: I use WS FTP LE and I am having trouble setting the permissions for my
: directories. I can chmod the files in the directories but I can't chmod the
: directories. Can someone please help!
No, obviously there is no help for you since you seem to think that a
post about a Windows application and directory permissions belongs in
a newsgroup dedicated to perl (a programming language).
I am quite interested in knowing what path of reasoning you followed
to arrive at the conclusion that your post belonged in this newsgroup.
John
------------------------------
Date: Wed, 21 Apr 1999 10:08:34 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Q: perl process won't go away
Message-Id: <MPG.1187a5ea6d78924d9896b6@news.idt.net>
It's not perl, it's NT. NT, in some instances, will not let go of a
process and will not allow it to be killed. I had a similar problem when
attempting to use Perl to access Excel using OLE. Although, Excel is
what hung, not perl. I could release the process, NT kept telling me
that I didnt' have permission to kill the process.
My solution: I use a linux box running apache and ssl now...
Daniel
In article <1tdT2.279$FS3.342@news.rdc1.sfba.home.com>, ji1@home.com
says...
> We have some cgi scripts that is written in perl. The web server
> is NT/IIS4. We are using perl.exe, not perl.dll. For some reason,
> the perl.exe process won't go away after the execution. Eventually
> the system will run hang. By the way, we are using activestate perl
> 5.007. We tried 5.008 and 5.015 build. Same problem.
>
> Can someone shed some light on it? Thanks.
>
>
> Jim
>
>
>
>
------------------------------
Date: 21 Apr 1999 14:39:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Random number generator
Message-Id: <7fknu9$4fd$2@client2.news.psi.net>
michel (michel@netstyle.nl) wrote on MMLIX September MCMXCIII in
<URL:news:7fk5df$vfc$1@enterprise.cistron.nl>:
{} Hi all,
{}
{} How do I give a scalar a random value between 10.000 and 99.000
Did you bother to look up the random function in the Perl documentation?
Abigail
--
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
------------------------------
Date: Wed, 21 Apr 1999 14:52:30 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: michel <michel@netstyle.nl>
Subject: Re: Random number generator
Message-Id: <371DE62D.555C77A2@no.spam.technologist.com>
michel wrote:
>
> @random_number=10.000+{RAND(1)*89.000} ???????
>
You've written a random newsgroup posting program haven't you?
;-)
Michael
------------------------------
Date: Wed, 21 Apr 1999 10:50:06 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Random value for Scalar
Message-Id: <7fko4r$q1i$1@nntp4.atl.mindspring.net>
Ours wrote in message <7fkafo$7pv$1@news.casema.net>...
:Hi All,
:is there a way (sure, but how) to generate a random number and assign it to
:a scalar?
:Something like:
:
:$RAN_NUM = 10000+(RAND[1]*89000);
:
:to generate a number between 10.000 and 99.000 for $RAN_NUM ??
perldoc -f rand
perldoc -f sprintf
$RAN_NUM = sprintf("%.3f",10 + rand(89));
HTH
AMD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
"Help save the world!"
- Larry Wall in README
------------------------------
Date: 21 Apr 1999 14:41:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Suggestions and oneliners for Perl-talk?
Message-Id: <7fko2v$4fd$3@client2.news.psi.net>
Thorbjoern Ravn Andersen (Thunderbear@bigfoot.com) wrote on MMLIX
September MCMXCIII in <URL:news:371D9319.BE313067@bigfoot.com>:
@@
@@ I would also like some one-liners to spice up the show :-) I am looking
@@ for stuff for everyday use (like convert all filenames to lowercase) but
@@ also show-offs like "Crack in one line of Perl".
The Perl Journal has a few one liners in each issue.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: 21 Apr 1999 14:44:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Suggestions and oneliners for Perl-talk?
Message-Id: <7fko8s$4fd$4@client2.news.psi.net>
Kim Saunders (kims@tip.net.au) wrote on MMLIX September MCMXCIII in
<URL:news:924690327.499985@draal.apex.net.au>:
%%
%% The way you can just whack string names in double-quoted strings is SO COOL!
^^^^^^^^^^^^ I assume you mean variables.
%% Where does this come from??? Not C, I don't think. NOT basic.... These
%% mystical "sed, awk" of which perl supposedly derives???
sed and awk are neither mystical, nor is Perl derived from them. Perl has
borrowed syntax and features from many sources, including sed and awk,
but C and shell are major contributors as well.
Variable interpolation is found in the shell as well.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Wed, 21 Apr 1999 11:46:36 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: Too many SIGCHLDs ?
Message-Id: <dwilgaREMOVE-2104991146360001@wilga.mtholyoke.edu>
In article <371DA509.88550592@bilbo.iok.net>, Dennis Wetzig
<dennis@bilbo.iok.net> wrote:
> Hi,
>
> I have the problem that my program forks a lot of children (, which
> exit correctly), whose SIGCHLDs do not seem to be caught correctly.
One of the perl docs (perlipc?) suggests this method instead, and it has
worked well for me:
sub REAPER {
$waitedpid = wait;
$SIG{CHLD} = \&REAPER; # loathe sysV
}
$SIG{CHLD} = \&REAPER;
The addition of the line with "loathe sysV" in it seems to imply that the
signal handler gets uninstalled during the signal itself, and therefore
needs to be reset.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Wed, 21 Apr 1999 03:34:55 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Which cgi tool should i use ?
Message-Id: <v2vjf7.295.ln@magna.metronet.com>
Austin Ming (austin95002887@yahoo.com) wrote:
: Any CGI expert please give me a reommendation.
Uhhh, you have landed in the wrong newsgroup.
If you have a question for a *Perl* expert, post it here.
If you have a question for a CGI expert, post it where the
CGI experts hang out:
comp.infosystems.www.authoring.cgi
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 21 Apr 1999 08:45:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: why are only certain bareword hash keys ambiguous?
Message-Id: <MPG.11879251b9688f99898f6@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <371DAAF8.CFC9C0B0@catnmoose.com> on Wed, 21 Apr 1999
06:39:52 -0400, Marty Landman <marty@catnmoose.com> says...
> Occasionally I get the following type of message on a compile:
>
> >>Ambiguous use of {title} resolved to {"title"} at EditSpec.pl line
> 91.<<
>
> The program in question had references to five different keys for a hash
> being assigned in the routine, all barewords but Perl only considered
> two of them to be ambiguous. What causes this and how might I deal with
> it in a consistant way preferably w/o enclosing all my hardcoded keys in
> quotes?
Your version of perl is warning about an all-lower-case bareword that is
(or potentially might become) the name of a built-in Perl function.
Recent versions of perl no longer give this warning.
Upgrade your perl, or include at least one capital letter in every such
key, or (as you say you don't want to) use quotes.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
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 5440
**************************************