
BillKSmith
Veteran
Feb 10, 2011, 6:02 PM
Post #2 of 3
(271 views)
|
|
Re: [Zamereon] Sorting Array and Parsing a string
[In reply to]
|
Can't Post
|
|
The function that you want to accomplish is:
my @sorted_sites = sort {$counts{$b} <=> $counts{$a} } keys %counts; foreach my $site ( @sorted_sites[0..9] ) { print $site, ' ', $counts{$site}, "\n"; } This may be too slow if the number of sites is large. There are ways to speed it up, but this is probably ok. Note: It is very difficult to get dates right without modules. It is even harder to prove that they are right. Use the module! Good Luck, Bill
|