We don't bite newbies here... much | |
PerlMonks |
Re: Sorting Hash By Large Number Valuesby JediWizard (Deacon) |
on Aug 02, 2005 at 23:36 UTC ( [id://480318]=note: print w/replies, xml ) | Need Help?? |
you need to use numeric comparison rather than string comparison. Aka. <=> or the "spacship operator". Change cmp to <=>. See perlop Update In the intrest of being complete: You may have troubles if not all values are numeric. I believe that Regex::Common::Number can help you identify numbers as opposed to strings. Update 2: I just checked.... numbers should sort lexicographically prior to letters... that should not cause much of an issue. Sorry for the false lead. They say that time changes things, but you actually have to change them yourself. Andy Warhol
In Section
Seekers of Perl Wisdom
|
|