in reply to printing hash values, (don't need the keys)

Not Perl I know, but surely this would be easier:

sort -u filename > sorted_filename