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


in reply to Crazy hash sorting issue.

TMTOWTDI, of course, but how about:
foreach my $key (sort { substr($hash{$a}, -2) cmp substr($hash{$b}, -2 +) } keys %hash) { print $key . ' ' . $hash{$key} . "\n"; }
Tested, seems to work.

-- Kirby, WhitePages.com