COSC 146
Team Programming Project


Description:

Write a complete perl program that will perform text concordance. That is, given an input file, the program should count the number of
occurences of each word appearing in the file.

Some specifications:

- the input file name is specified on the command line. If the file does not exist, an error message should be displayed and the program terminates.
If too many parameters are specified (more than 1) an error message is displayed and the program terminates.

- output from the program should consist of two lists: the first list is an alphabetical listing of all the words followed by a word count for each word.
The second listing is an ascending list of word occurences followed by the words. For example, a sample output might be:


apple    23
bat        10
cat         6
dog       8


6          cat
8          dog
10        bat
23        apple

Output of your program should go to a file that consists of the basename of your input file plus the suffix ".stat"
So if the input file is story.txt then the output file should be stort.stat

Some suggestions:

Modularize your program! Write subroutines and test each one individually. Suggested format:

&open_file;            # open the file, do all error checking
&process_file;        # while loop to read each line of the input. call a subroutine called "parse" to get each individual word of the file
&close_file:            # sort the arrays and output to file


The subroutine &process_file is the most difficult. Get the other ones working first.

Teams:

The Yankees        The Red Sox                The Tigers                The Indians
Garry Arai            Dimuthu Bandara          Ryan Pooya               Chris Lucas
John Shpati           Igor Stoiljkovic             Anthony Riopelle      Emily Koopman
Adam Cohen        Zack Tansek                  Jason Ludwig            Shane Coleman
                                                                   Bradley Pidcock        Jon Camunag