foreach my $key (sort {$count{$a} <=> $count{$b}} keys %count) { ... }