12345678910111213141516171819202122232425262728293031
#!/usr/bin/perluse strict;use warnings;use Data::Dumper;my %stats;while (<DATA>) { next unless /(\d+)\s+(\d+)/; $stats{$2} += $1;}print Dumper \%stats;_ _DATA_ _ 183 5 1 78 2 73 3 20 4 7 5 285 9 1 79 2 128 3 63 4 5 5 1 6