Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Randomize lines with limited memory

by sauoq (Abbot)
on Nov 01, 2003 at 23:18 UTC ( #303855=note: print w/ replies, xml ) Need Help??


in reply to Randomize lines with limited memory

Here's an implementation of the suggestion I made in my reply to Corion...

#!/usr/bin/perl -w use strict; use Tie::File; use List::Util qw( shuffle ); tie my @file, 'Tie::File', $ARGV[0] or die "$ARGV[0]: $!"; print $file[$_], "\n" for shuffle 0 .. $#file;
Short and sweet. :-)

-sauoq
"My two cents aren't worth a dime.";


Comment on Re: Randomize lines with limited memory
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2015-07-01 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls