#!/usr/bin/perl # # Convert IP to hostname (domain name) # while ($ln = ){ if ($ln =~ /^(\d+\.\d+\.\d+\.\d+)/) { $ip = $1; $rest = $'; if ($host = gethostbyaddr(pack("C4", split(/\./, $ip)), 2)) { $ln = $host . $rest; } } print $ln; } exit;