%rec_counts={}; #### while (defined($line = )) { $rec_type = substr($line, 19, 2); $rec_counts{$rec_type} += 1; } #### foreach $key (sort keys(%rec_counts)) { print "Record count of $key is $rec_counts{$key}\n"; } #### Record count of 00 is 1 Record count of HASH(0x4000473c) is Record count of T is 315