- 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, {key => $_, value => $hash{$_}} for @sorted;
- or download this
use Data::Dumper;
print Dumper(\@array_of_hashes);
- or download this
$VAR1 = [
{
...
'key' => 'baz'
}
];