>I have a list of inspection stations in a data file which is
>comma-separated. It contains the following data, in order:
>Station Name, Address 1, Address Line 2, City, State, Zip, Phone Number
>
>I need to group the lines (of address information) by city and get a count
>of the number of stations in a given city.
OK, I didn't actually test this exact code, but it should present the idea
of storing this information in an array of arrays:
open IN, yourfile;
while (<IN>){
chomp;
push @arr, \[split /,/];
}
close IN;
@arr = sort ${$arr[$a]}[3] <=> ${$arr[$b]}[3] @arr; # sort by city
How do you picture using a hash of hashes of arrays?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]