in reply to sort hash by value
You almost had it. You need to wrap the sort in {} and the hash in parenthsis.
foreach (sort {$hash{$a} cmp $hash{$b}} (keys %hash) [download]