# 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