go ahead... be a heretic | |
PerlMonks |
Re: Simple regex wordlist questionby Zaxo (Archbishop) |
on Sep 11, 2007 at 05:24 UTC ( [id://638228]=note: print w/replies, xml ) | Need Help?? |
That's an anagram problem, which has a canonical answer. First absorb your dictionary in a hash:
That collects your data, now just rearrange your input word to make a key and print the associated words: Alphabetizing and mushing together the characters of a word provides a key for anagrams.. If this is used a lot or the dictionary is big, you may want to keep the "hash" in a database. After Compline,
In Section
Seekers of Perl Wisdom
|
|