Sample code for 30+ languages & platforms
Perl

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.

Chilkat Perl Downloads

Perl
use chilkat();

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$socket = chilkat::CkSocket->new();

$maxWaitMs = 10000;
$ipAddr = $socket->dnsLookup("www.chilkatsoft.com",$maxWaitMs);
if ($socket->get_LastMethodSuccess() != 1) {
    print $socket->lastErrorText() . "\r\n";
    exit;
}

print "IP Address: " . $ipAddr . "\r\n";