>
> Reversing the hash is more work than it's worth, as you've found out.
Certainly true and here is my mea culpa :))-
It just did not occur to me about the,
@keys = sort { $hash{$b} <=> $hash{$a} } keys %hash;
statement. Thanks Japhy and Nikola.
- Rex
On Jan 31, [EMAIL PROTECTED] said:
>I have a simple hash with directory names as keys and sizes as values. I
>would like to print the hash, in descending order of the size of each
>directory.
# this sorts your keys based on their values, descending
@keys = sort { $hash{$b} <=> $hash{$a} } ke
I have a simple hash with directory names as keys and sizes as values. I
would like to print the hash, in descending order of the size of each
directory.
I was contemplating of "reversing" the hash(so that sizes become keys and
directory names become values) and then do a sort on the keys. Howeve