#This bool function returns whether the second argument #string can be built with the first arguments letters sub match($$$) { my ($self,$letters,$word) = @_; $letters = lc($letters); $word = lc($word); #Now we build our hashes my (%letter_hash, %word_hash); while($letters) { $letter_hash{chop($letters)}++; } while($word) { $word_hash{chop($word)}++; } #Now to analyze my ($key, $value); while(($key,$value) = each(%word_hash)) { $letter_hash{$key} = $letter_hash{$key} - $value; return 0 if ($letter_hash{$key} < 0); } #Must be good return 1; }