The stupid question is the question not asked | |
PerlMonks |
Re: Opening random files then reading random lines from file.by BillKSmith (Monsignor) |
on Apr 27, 2012 at 15:26 UTC ( [id://967667]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|