in reply to Reading through a file and checking for a specific string

Your counts are in @counts not @sums
for( $j=0; $j<@types; $j++ ) { print "$types[$j]\t: $counts[$j] \n"; } print "Total\t: $sum";