
use strict 'vars';
unless (open DATABASE, "<", "db.txt") {
    die "Couldn't open database db.txt: $!; aborting";
}

my %count;
<DATABASE>;      # Discard initial line
while (<DATABASE>) {
  chomp;
  my @fields = split /:/;
  my $state = $fields[3];
  $count{$state} += 1;
}

my @states = keys %count;
for my $state (@states) {
  print "$state: $count{$state}\n";
}

