On Thu, Jun 20, 2002 at 02:49:37PM -0600, Rob 'Feztaa' Park wrote: > This is trivial to do in perl: > > open "FILE", "<file.txt"; > > while (<FILE>) > { > push @lines, $_; > } > > print $lines[int(rand(@lines))];
or, the more efficient way: open "FILE", "<file.txt" or die "$!"; rand($.) < 1 && ($line = $_) while <FILE>; close FILE; print $line; from "perldoc -q random" :) -- Dan Boger Linux MVP brainbench.com
msg29098/pgp00000.pgp
Description: PGP signature