http://www.perlmonks.org?node_id=814363


in reply to Sorting integer value hash keys

#!/usr/bin/perl my %statistics = ( 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0 ); foreach my $statistic (sort {$a <=> $b} keys %statistics) { print $statistic ." ".$statistics{$statistic}. "\n"; } Output: 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0