in reply to Help with calculating stats from a flat-file database
Once you have the format and can convince yourself that you are parsing the data properly, I would use a hash to count tornado days. Something like this:
If your dates span more than a year, you will have to add extra logic to parse and filter dates.while (<>) { # parse line my ($date, $state) = ... $tornadoes{$state}{$date}++; } foreach my $state (1..50) { print "State = $state, tronadoes = ", scalar keys %{$tornadoes{$ +state}}, "\n"; }
-Mark
|
|---|