Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Keep It Simple, Stupid
 
PerlMonks  

Re: Opening random files then reading random lines from file.

by BillKSmith (Friar)
on Apr 27, 2012 at 15:26 UTC ( #967667=note: print w/ replies, xml ) Need Help??


in reply to Opening random files then reading random lines from file.

You say that you want to open random files (plural). If you really mean to open all the files in random order (no repeats) you have more to do than putting one of the previous suggestions in a loop. You should 'shuffle' the list of file names and then open the files in the order of the shuffled list. The "Perl Cookbook" also discusses this in some detail. I recommend the shuffle function in the module List::Util


Comment on Re: Opening random files then reading random lines from file.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2013-05-20 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (411 votes), past polls