#/usr/bin/perl -w use strict; use Socket; my $host = "www.yahoo.com"; my @addresses = gethostbyname($host) or die "Can't resolve $host: $!\n"; @addresses = map { inet_ntoa($_) } @addresses[4 .. $#addresses]; print "The next set is @addresses \n"; #### #/usr/bin/perl -w use strict; use Socket; my $host = "www.yahoo.com"; my $packed_ip = gethostbyname($host) or die "Unable to resolve '$host'\n"; my $ipaddr = inet_ntoa($packed_ip); print "$ipaddr for $host\n"; my $packed_add = gethostbyaddr($ipaddr, AF_INET); my $hostname = inet_aton($packed_add) or die "Can't reverse lookup \n"; print "The host name for $ipaddr is $hostname \n"; my $name = "www.perl.com"; my @addresses = gethostbyname($host) or die "Can't resolve $name: $!\n"; @addresses = map { inet_ntoa($_) } @addresses[4 .. $#addresses]; print "The next set is @addresses \n";