> I just wrote small script to resolve domain name on basis IP address and vice versa, do you think it is the best and fastest way? Thanks. > my ($host, $ip); > > $host = 'www.google.com'; > $ip = inet_ntoa(inet_aton($host)) || 'no IP'; print "$host: $ip\n"; > > $ip = '213.160.174.5'; > $host = gethostbyaddr(inet_aton($ip), AF_INET) || 'no DN'; > print "$ip: $host\n"; >
Looks fine to me. Here are few other things you can play with $host = 'www.google.com'; $net_ip=inet_aton($host); my(@quad) = unpack('C4', $net_ip); print join( ".", @quad); -------------- $ip = "68.142.226.45"; $host = gethostbyaddr(pack('C4',split('\.',$ip)),2); print $host; --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.772 / Virus Database: 519 - Release Date: 10/1/2004 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>