But that can be prohibitively expensive for large text files. What's the best way to do this? Thanks.@lines = <file>; #read the whole friggin' thing into memory $_ = @lines[int rand scalar @lines - 1];
In reply to reading a random line from a file by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |