On Fri, 24 Jan 2003, david wrote:

> Glenn Tremblay wrote:
> 
> 
> > Actually, the funny part of all this is that every station will be in the
> > same state.  I need to include the state information regardless.
> >  
> > The output needs to allow me to loop through each city, somehow, and print
> > out the address data for each station in that city.
> > 
> 
> in that case, this should do it:
> 
> #!/usr/bin/perl -w
> use strict;
> 
> my %hash;
> 
> while(<DATA>){
>         my @fields = chomp && split(/,/);
>         push(@{$hash{$fields[3]}},\@fields);
> }
> 
> 
> for(keys %hash){
>         print "$_ has ",scalar @{$hash{$_}}," stations and they are:\n";
>         for(@{$hash{$_}}){
>                 print <<INFO;
> Name:     $_->[0]
> Street 1: $_->[1]
> Street 2: $_->[2]
> City: i   $_->[3]
> State:    $_->[4]
> Zip:      $_->[5]
> Phone:    $_->[6]
> 
> INFO
>         }
> }
> 
> __DATA__
> david
> 
> 

Cool! Thanks for your help, folks. It works!! 

-Glenn


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to