Rob Hudson wrote:

> I want to pick a random word from dict/words file, basically pick a
> random line in a file.

$ perl -e '@x=(<>); print $x[int rand @x]' /usr/dict/words

Or, using less memory, ...

$ perl -ne '$l = $_ if ! int rand $n++; END { print $l }' /usr/dict/words

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     [EMAIL PROTECTED]

Reply via email to