Due Thursday, July 30th, at the start of class.
This is an extension of the previous regular expression assignment. In this assignment, you'll write a perl module that reads the same file with names and addresses, and provides access to that data. Additionally, you'll need to write a simple program which employs this module.
This module should read the list of names/addresses from a file; the name should be read from the command line. The program should pass this file name to an initialized function in the module. Each line in the file contains a name / address pair.
The module should parse these lines, extracting the name, the street address, the city name, the state, and the zip code.
The module should store the various data fields indexed by the name, and by city/state. When duplicate names are encountered, both should be stored. The module should provide accessor subroutines to:
The program should start up by initializing the module, passing it the file name of the data file. After that, it should loop, allowing the user to enter a command:
You'll need to use to use the capture capabilities that you've learned in the past, and perl's various data structures.
Do the work yourself, consulting reasonable reference materials as needed; any reference material that gives you a complete or nearly complete solution to this problem or a similar one is not OK to use. Asking the instructors for help is OK, asking other students for help is not.
A printout of your script on a single sheet of paper. At the top of the printout, please include “CS 368 Summer 2009”, your name, and “Homework 10, July 30, 2009”. Identifying your work is important, or you may not receive appropriate credit.