in reply to Creating Reports
This is a sample implementation of summing by just state and then also by city and state.
while ( ... ) { my $last_name = ...; my $address = ...; my $city = ...; my $state = ...; # Aggregate by state $SumStates{ $state }++; # Aggregate by city $SumCityStates{ $state }{ $city }++; } # Print sums for my $state ( keys %SumStates ) { print "$state: $SumStates{ $state }\n"; for my $city ( keys %{ $SumCityStates{ $state } } ) { print " $city: $SumCityStates{ $state }{ $city }\n"; } }
|
|---|