Perl: Sorting a hash
This syntax still doesn't make much sense to me but here is how you sort a perl hash by value. This returns a list of all the keys of the hash sorted in the order you want. To reverse the sort simply change $a and $b locations with each other.
my @sort = sort{ $unique{$a} <=> $unique{$b} } keys %unique;