7e87bda16c4ce1096550ad555bad07a6c4a28ab3
3 use Catacomb
qw(:random
);
4 use Getopt
::Long
qw(:config gnu_getopt
);
8 GetOptions
("dict=s" => \
$dict, "help" => \
$help) or exit 1;
11 last DICT
if defined $dict;
12 $dict = $ENV{"DICT"}; last DICT
if defined $dict;
13 $dict = "/usr/share/dict/words"; last DICT
if -r
$dict;
14 -r
$dict or $dict = "/usr/dict/words"; last DICT
if -r
$dict;
15 die "no appropriate word list";
17 open DICT
, "$dict" or die "can't open $dict: $!";
21 if (defined $filter) {
22 eval "sub filter { $filter };";
26 $rng = Catacomb
::Rand
::Counter
->new("blowfish", $random->fill(32));
30 WORD
: while (<DICT
>) {
32 next WORD
unless filter
;
33 $rng->range($i) == 0 and $word = $_;