in reply to reading a random line from a file
That should print out a random line in a file without having to do a slurp.open(my $f, $your_file) or die("ack: $!"); seek($f, int rand(-s $f), 0); { local $/ = \1; ## anyone care to optimise this? seek($f, -2, 1) until ($c = <$f>) eq "\n" or tell($f) == 0; } print scalar <$f>;
_________
broquaint
|
|---|