#!/usr/local/bin/perl # # Obtain an IP address for a host name # The gethostbyname function uses whatever name service the system # you run it on is configured to use. For example, this may be # local hosts files, NIS, NIS+, or of course, DNS. # # This output is meant to be easier to use than the information # returned by nslookup. # # Andy Welter # www.the-welters.com # January 16, 2001 # $host=$ARGV[0]; $addr=gethostbyname($host); if ( $addr ) { ($a,$b,$c,$d)=unpack ('C4', $addr); print "$a.$b.$c.$d\n"; } else { exit 1; };