Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: parsing file

by TexasTess (Beadle)
on Jul 08, 2002 at 23:23 UTC ( [id://180348]=note: print w/replies, xml ) Need Help??


in reply to parsing file

You can do a while loop and load them into an array..then use the random number generator to randomly select a value from zero to max array index and thus select ONE of them...randomly...
open(FILE,$FILEVARNAME); While(<FILE>){ (/^\s*$/) and next; chomp $_; push(@array,$_); } close(<FILE>); $SIZE=@array; $select = rand($SIZE); print @array[$select];


TexasTess
"Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Albert Einstein

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://180348]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-23 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found