#option -u(nscramble) ... if($opt_u){ #open default if not specified open(IN, $opt_d ? "<$opt_d" : "<$database"); #build the lookup table while(){ ($value, $key) = split /:/; chomp $key; push @{$hash{$key}}, $value; # each hash value is an arrayref } #arange the letters to match format of database $sorted = join "",sort split//,$opt_u; #display unscrambled word print join ', ', @{$hash{$sorted}} , "\n"; }