use Socket; $packed_ip = gethostbyname shift; if (defined $packed_ip) { $ip_address = inet_ntoa($packed_ip); print $ip_address; } else { print "Host not exist\n"; }