A few points:my @buffer; push @buffer, scalar <IN> for 1 .. $N; while (my $line = <IN>) { next unless rand($.) < $N; $buffer [rand @buffer] = $_; } print @buffer;
In reply to Re: Picking Random Lines from a File
by JavaFan
in thread Picking Random Lines from a File
by de2425
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |