COP3353 - 2013 Spring
Assignment 3 "Solving Anagrams"
Due by 5:00pm Tuesday, April 2
Late assignments (50% grade penalty) can be turned in until April 9

Perl script for solving anagrams

Step 0

Login to linprog{1,2,3,4} I recommend going into bash, but it's not really necessary for this assignment, just convenient.

Step 1

Create a directory called assign3/ in your home directory:

Change directory into assign3/:

Create two new Perl scripts, and

(Hint: you may want to also log into linprog{1,2,3,4} with a second window, if you don't want to use a "shell" buffer inside of emacs for testing your script.)

Your assignment is to have create a dictionary to help someone solving an anagram.

This dictionary will have entries that look like this:


Each entry has a left-hand side that is just the sorted letters of each of the entries on the right-hand side. The two sides are separated by a colon. The entries on the right-hand side are separated by commas.

So, for instance, the key for the word "spot" would be "opst". The key for the word "tops" would also be in "opst", and thus they should both be in an entry like:


Your script should be run over the file on linprog1 named /usr/share/dict/linux.words:

You can check your resulting dictionary.txt file against this one.

So for instance, the entry for "you'll" should look like:


And for the word "a1", it shouldn't appear in your dictionary.txt file.

The entry including "Atlas" should look like:


Your other program,, should take as a single argument a word to be looked up. Your program should take whatever is entered and put it in sorted order, and then search your dictionary.txt file for that entry.

% ./ atlsa
The possible anagrams for "atlsa" are "Aalst,ATLAS,Atlas,atlas,salat,Salta,salta,Staal,talas"


Like the previous assignments, you should cd back into your home directory and create a tar file, named with the result the uuidgen program:

Please make sure that all three files (dictionary.txt,, and are included in the tar file.

And, as previously, please copy the tar file to the directory ~rlangley/Assignment03/.