for my $line (sort {$count_hash{$b} <=> $count_hash{$a}} keys %count_hash) { print "$line $count_hash{$line}\n"; }