my %counts; while (<$fh>) { chomp; my @fields = split /\t/; $counts{ $fields[3] }++; } #### for ( sort { $a <=> $b } keys %counts ) { print("$_: $counts{$_}\n"); }