Might seem really obvious, but you can't define a sort for hash keys without using the keys in the sort parameters. sort keys %hash works, but if you define the sort, such as sort {$b <=> $a} keys %hash, it doesn't. Try this instead. (I was asked by a friend about this. Solution might help other people learning.)
@sortedkeys = (sort { $hash{$b} <=> $hash{$a} } keys (%hash));