Seperating a scaler into various components.
- From: "Zachary" <zaque@xxxxxxxxxxx>
- Date: 15 Apr 2006 09:05:03 -0700
I work at UPS and currently wish to change positions. The position
requires me to learn a large amount of US zip codes. I've also been
working through the "Learning Perl" book by Schwartz and
Christiansen as hobby ( yall can't have all the fun ). I want to
create an app that will test my knowledge of zip codes. I have to know
which zip codes to send to different parts of the building. The list of
zip codes are in a text file that looks like this:
37016 AUBURNTOWN TN ORANGE
37082 KINGSTON SPRINGS TN ORANGE
37601 JOHNSON CITY TN BLACK
37616 ASHTON TN GREEN
38128 BARTLETT TN BLUE
.... and so on.
Each line is read in as a scaler but I need to separate the scaler into
$zip, $city, $state, and $color. Here's how I'm trying to do it:
( $zip, $city, $state, $color ) = /(\S+)\s+(\S+)\s+(\S+)\s+(.*)/;
The problem is when the city is 2 words. I also don't know how to deal
with a blank line which produces some error messages.
.
- Follow-Ups:
- Re: Seperating a scaler into various components.
- From: Xicheng Jia
- Re: Seperating a scaler into various components.
- From: Xicheng Jia
- Re: Seperating a scaler into various components.
- Prev by Date: "use warnings" not working in Perl 5.8.8
- Next by Date: Re: reference to a hash
- Previous by thread: "use warnings" not working in Perl 5.8.8
- Next by thread: Re: Seperating a scaler into various components.
- Index(es):
Relevant Pages
|