- or download this
use strict;
my %foo = (1 => 'value1',2 => 'value2',3 => 'value3');
- or download this
print "$foo{$_}\n" foreach sort {$a <=> $b} keys %foo;
- or download this
sub sort_hash {
my %hash = @_;
...
my %foo_sorted = sort_hash(%foo);
print "$foo_sorted{$_}\n" foreach keys %foo_sorted;