http://qs321.pair.com?node_id=729238

haoess has asked for the wisdom of the Perl Monks concerning the following question:

Like in Perl 5 you can print your hash sorted by its values:

my %nums = ( four => 4, one => 1, three => 3, two => 2, ); for %nums.keys.sort: { %nums{$^a} <=> %nums{$^b} } -> $key { say "$key {%nums{$key}}"; }
Output (it works with my latest Rakudo checkout):
one 1 two 2 three 3 four 4

Maybe there's a more comfortable (aka shorter) way to get this, without writing %nums three times on the same line?

Thanks, Frank