- or download this
my %hash = (
foo => 2,
...
);
my @array = sort {$hash{$a} <=> $hash{$b}} keys %hash;
- or download this
my @array_of_hashes;
push @array_of_hashes, "$hash{$_} => $_\n" for @array;
- or download this
use Data::Dumper;
print Dumper(\@array_of_hashes);
- or download this
$VAR1 = [
'1 => bar',
...
'2 => foo',
'3 => baz'
];