http://qs1969.pair.com?node_id=133929


in reply to More Sorted Business with Hashes

Is there a way to sort a hash by values and leave it in a hash?

No. Hashes are inherently non-ordered. However, for what you're trying to do, something like

@keysByValue = sort { $clients{$a} cmp $clients {$b} } keys %clients;
will give you keys ordered by value.