Sorting a hash by value
Of course, any expression can be used as the sort criteria:
> my %h = <apple 4 cherry 7 banana -6>;  
> .say for %h.sort( { .value } );
banana  -6
apple   4
cherry  7
> .say for %h.sort( { .value.abs } );  # sort by absolute value
apple   4
banana  -6
cherry  7