sub by_hashval_func { my ( $hashref ) = @_; return sub($$) { $hashref->{ $_[0] } cmp $hashref->{ $_[1] } }; }