Hi all,
I want to make a script that sorts the values from a hash.
I want to make a "top with the most downloaded files".
I know how to sort the hash by keys but I couldn't sort it by values.
I have a hash like:
%hash = (
file1 => 3,
file2 => 11,
file3 => 6,
....
fileN => 22
);
I would like to print the name and the number of the downloads in descending
order like:
filename number x: 33
file number y: 6
...
file number z: 2
Is there a function that sorts by values?
I've tried (but with no results:
foreach $cnt(sort values(%hash)) {
print "$hash{$cnt}: $cnt<br>";
}
Thank you for any tips.
Teddy,
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]