Don't ask to ask, just ask | |
PerlMonks |
Sorting hash valuesby K_M_McMahon (Hermit) |
on May 23, 2005 at 05:26 UTC ( [id://459449]=perlquestion: print w/replies, xml ) | Need Help?? |
K_M_McMahon has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow Monks. I am sure there is a simple (and obvious) answer to this question that I am just overlooking. Thanx for any help you can give me would be great!
I threw together a script to scan through my linux message log to track the failed login attempts. I was trying to see which IP addresses were responsible for most of the attempts. (also which usernames were tried multiple times). I created a hash to store the IP address as the key and the times found as the count. How do I get the results sorted by frequency. I don't know how to sort by the value, and I can't make the count the key because it is not unique. I tried pushing the result strings into an array which I can sort if the number is first, but that failed to sort properly since I can't use {$a<=>$b} because of the text!
What obvious solution am I missing? -Kevin
Back to
Seekers of Perl Wisdom
|
|