1#!/usr/bin/perl 2 3$iterations = shift(@ARGV); 4for ($i = 1 ; $i <= $iterations ; ++$i) { 5 open (FILE, "profile.$i") || die; 6 while (<FILE>) { 7 /\s*(\d*)\s*(\S*)/; 8 $map{$2} += $1; 9 } 10} 11 12foreach $key (keys %map) { 13 $value = int $map{$key}/5; 14 print "$value $key\n"; 15} 16