in reply to Sort of anonymous hash

Perhaps it is too obvious, but you could change keys %{hash} to values %{hash}