in reply to How to sort HASH?
# This section will count the number of times we see an ip address open ACCESSLISTIPS, "access_log_ips" or die "The file could not be opened ($!)"; chomp(@ips = <ACCESSLISTIPS>); foreach $ip (@ips) { $count{$ip} += 1; } # This routine will sort the values of a hash then print them out for +us. # foreach $ip (sort { $count{$a} cmp $count{$b} } keys %count) { print "$ip was seen $count{$ip} times.\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to sort HASH?
by Limbic~Region (Chancellor) on Apr 05, 2004 at 18:19 UTC | |
by u235sentinel (Hermit) on Apr 05, 2004 at 21:43 UTC |