in reply to Save the resultant of " hash sorted by values "

Hashes are inherently unsorted so save your sorted keys in an array and reuse it whenever you want to print the hash in sorted order.

my @sortedKeys = sort {$ipaddr {$a} cmp $ipaddr {$b}} keys %ipaddr; ... print OUT "$ipaddr{$_}\t$_\n" for @sortedKeys;

Update: Corrected error in print statememnt, s/$key/$_/g, pointed out by wind, thanks.

Cheers,

JohnGG