Mega Code Archive

 
Categories / Perl / Network
 

Get the DNS address of a host by using inet_ntoa and inet_aton

use Socket; $site_name = 'www.cpan.org'; $address = inet_ntoa(inet_aton($site_name)); print "The DNS address of www.cpan.org is $address";