Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: More Sorted Business with Hashes

by Aristotle (Chancellor)
on Dec 23, 2001 at 01:57 UTC ( [id://133994] : note . print w/replies, xml ) Need Help??


in reply to Re: More Sorted Business with Hashes
in thread More Sorted Business with Hashes

Almost.
-values=> [sort{$clients{$a} cmp $clients{$b}}keys %clients],
Note the use of cmp (which sorts alphanumerically) rather than <=> (which sorts numerically). Because Spenser has non-numerals as hash values, <=> will produce seemingly unsorted results.