Thanks David, this works in the form that you gave me. However, I am butchering it up to try and see if it will work with all the values I have and I run into this error.
Illegal octal digit '9' at noname.pl line 10, at end of line I get the impression that perl is interpreting one of my zips as something other than an integer or range of integers and I am unsure of why it is doing this or what to do to remedy it. I got the same error when I was trying to run the one I had written prior to your good advice. I assumed that I somehow had misunderstood what I could and could not do with a hash, but now I see that it is the numbers I am using. Can I escape this problem and still have my hash perform as expected? This is the end of line 10: map{'zone 6'} {043,044,046..049,567,576,577,582..588,592,593,693,798..820,822..830,865..88 5}; And the previous line 9: map{'zone 5'} {004,005,010..042,045,050..146,148,149,169,180..196,330..334,349,496..505,50 8..516,521,539..566,570..575,580,581,664..666,668..672,674..692,730..739,746 ...748,750..754,758,760..797}; As you can see, the zones are a bit more involved, but the method should remain the same should it not? wiggins: Thanks for the perlcircus link. TIA, Mark > I don't think you need to do a lot of typing. your best approach(i think of > course) is to use the zip code as key and the zone code id as value. if you > use the other way around, you are bound to find your searching algr. slow > becasue you have to search through tons of zip codes on each search. > > try: > > #!/usr/bin/perl -w > use strict; > > my %zips; > > @zips{100..200} = map{'zone 1'} (100..200); > @zips{201..300} = map{'zone 2'} (201..300); > @zips{301..400} = map{'zone 3'} (301..400); > > while(<STDIN>){ > exit if(/^exit/i); > chomp; > print "$_ is in $zips{$_}\n" if(exists $zips{$_}); > } > > __END__ > > run: > > 100 > 100 is in zone 1 > 300 > 300 is in zone 2 > 400 > 400 is in zone 3 > 123 > 123 is in zone 1 > exit > > david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]