Well here's an alternate,
a complete waste of cycles as it scales linearly with the number of words returned,
OTOH it is not bounded by the size of the dictionary.
(As is) It can also return duplicates, yada yada yada.
my(@lines, $line); open(FILE, shift) || die;
until( scalar @lines == $ARGV[0] ){
seek(FILE, 0, $. = 0);
rand($.) < 1 && ($line = $_) while <FILE>;
push(@lines, $line);
}
print @lines, "wc -l could have told you this is $. words\n";
It's based on "
How do I select a random line from a file?"
in
perlfaq5. I'd be interested in seeing if anybody else
has a better means of extending this algorythm to report
multiple entries.
--
perl -pe "s/\b;([st])/'\1/mg"