Net::DNS::Nslookup - Perl module for getting simple nslookup output.
Nslookup module provides simple way to resolve DNS name to
IP address(es) on a local system (Linux, Win*, Mac OS X 10.3.9, Solaris).
use strict;
use Net::DNS::Nslookup;
my $dnsname = "www.google.com";
my @nslookup = Net::DNS::Nslookup->just_ip($dnsname);
for (@nslookup) { print "$_\n"; }
Output:
Non-authoritative answer:
64.233.169.103
64.233.169.147
64.233.169.104
64.233.169.99
use strict;
use Net::DNS::Nslookup;
my @sites = ("www.google.com","www.cnn.com","www.jobs.com");
foreach my $dnsname (@sites) {
my @nslookup = Net::DNS::Nslookup->just_ip($dnsname);
for (@nslookup) { print "$_\n"; }
}
Output:
Non-authoritative answer:
64.233.169.103
64.233.169.147
64.233.169.104
64.233.169.99
Non-authoritative answer:
64.236.29.120
64.236.91.21
64.236.91.22
64.236.91.23
Non-authoritative answer:
204.188.136.6
204.188.136.9
@nslookup = Net::DNS::Nslookup->just_ip($dnsname);
Resolve name such as www.google.com to IP address(es).
This module requires "nslookup" binary.
man nslookup
Paul Grinberg, grinberg at isrcomputing.com
http://nsvu.blogspot.com
http://www.isrcomputing.org
Copyright (c) 2007 Paul Grinberg. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.