in reply to Help with calculating stats from a flat-file database

The first thing you have to do is discover the database format. Is it CSV? Then use Text::xSV to help parse it. Is it fixed format? Then use the unpack function to split the data. I have seen meterological information in both formats.

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:

while (<>) { # parse line my ($date, $state) = ... $tornadoes{$state}{$date}++; } foreach my $state (1..50) { print "State = $state, tronadoes = ", scalar keys %{$tornadoes{$ +state}}, "\n"; }
If your dates span more than a year, you will have to add extra logic to parse and filter dates.

-Mark