Computer Sciences Department logo

CS 368 (Summer 2009) — Day 8 Homework

Due Monday, July 27th, at the start of class.

Description

This is an extension of the previous assignment. In this assignment, you'll write a script that reads a file with names and addresses.

Details

This program should read the list of names/addresses from a file; the name should be read from the command line; or, if you prefer, the the input can be read from the standard input stream. Each line in the file contains a name / address pair.

The program should parse these lines, extracting the name, the street address, the city name, the state, and the zip code. For "zip + 4" 9 digit zip codes, we're only interested in the first 5 digits.

The program should then count:

Ultimately, what we're interested in is aggregate data. For each state, your program should report:

Address Format Details

The general format is:

Example Names / Addresses

Hints

You'll need to use to use the capture capabilities that we learned today, and perl's various data structures.

Reminders

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.

Files

Hand In

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 08, July 27, 2009”. Identifying your work is important, or you may not receive appropriate credit.