Overview
You are given these 2 files: dictionary.txt and jumbles.txt
The jumbles.txt file contains a bunch of scrambled words. Your job is to print out those jumbles words, 1 word to a line. After each jumbled word, print a list of real dictionary words that could be formed by unscrambling the jumbled word. The dictionary words that you have to choose from are in the dictionary.txt file.
Here is a screenshot of a sample run using the 2 input files above:
%./solveJumbles.pl nwae: wean anew wane eslyep: sleepy rpeoims: semipro imposer promise ettniner: renitent ahicryrhe: hierarchy dica: acid cadi caid dobol: blood nyegtr: gentry cukklen: knuckle warllc: NO MATCHES addej: jaded baltoc: cobalt mycall: calmly dufil: fluid preko: poker dupled: puddle yaldde: deadly lasia: alias nekel: kneel laurib: burial lappor: poplar couph: pouch celer: creel ettorp: potter wardty: tawdry iddec: diced pypin: nippy hartox: thorax perrim: primer gluhc: gulch irrpo: prior braney: nearby meefal: female lubly: bully noper: prone dobeny: beyond kutbec: bucket shewo: howes whose alvan: naval annaab: banana mopsie: impose nokte: token rodug: gourd rebisc: scribe hoybis: boyish milit: limit pudmy: dumpy hucnah: haunch genjal: jangle %
Step-By-Step
Open up the dictionary.txt file and read the words into an array (before going on - verify the read by echoing out the words back from the array out to the screen)Declare a hash table variable
You now have a hash table where eack key is the sorted form of a dictionary word and the value associated to it is a string or array of dictionary words that sort to that same key
Mad props...
...to Tim Hoffman for this wonderful lab.