in reply to sorting question
print "$_\n" for sort { $a <=> $b } values %hash; [download]
Cheers - L~R