my @word_list; sub rand_word { my $file = shift; if ( not defined $word_list[0] ){ open FIN, "<$file" or die("$file"); @word_list = map { chomp; $_ } <FIN>; close FIN; } my $r = int(rand(@word_list)); return $word_list[$r]; }
In reply to Re^2: Random word generator
by perreal
in thread Random word generator
by rooneyl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |