IWA-HWG Perl Course. Week 5 Project

Mailing Labels for List of Musicians

This program demonstrates the use of subroutines, regular expressions, and parsing. It reads the file WebX.txt, which is a colon-separated file containing information about musicians. An example line is

James Buffet:One Key West:White Sands:Hollywood:FL:30152:parrothead@beachcomber.net:Cheeseburger is heaven is paradise

The file is read and parsed. The total number of data characters are counted. Regular expressions are used to eliminate any leading or trailing white space for the data (tokens). They are also used to validate the format for the state code (two capital letters, such as CA for California) as well as the format for the zip code (five numbers, such as 19141). They are further used to validate (partially) the email address.

The user can add new records to the list. The user can also opt to print to a file having the format of address labels. The code for these is placed in subroutines.

The code music.plx uses the file WebX.txt supplied for this assignment.