my @sorted_keys = %hash.keys.sort #### %hash.keys.sort({ %hash{$_} }); #### # return a random, anonymous hash: sub h { return %( (1..10).pick(*) ) } # and get the keys sorted numerically by value: my @keys = h().sort( { .value })>>.key