homepage Welcome to WebmasterWorld Guest from 54.166.255.168
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Name to IP conversion in perl?
Brett_Tabke

WebmasterWorld Administrator brett_tabke us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 155 posted 5:33 pm on Aug 1, 2000 (gmt 0)

Ok, I have IP to domain name conversion down pat. I was just presented with a task of going the other way from Domain name to IP. What is the fastest way in perl?

 

littleman

WebmasterWorld Senior Member littleman us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 155 posted 2:02 am on Aug 2, 2000 (gmt 0)

This works,
use Socket;
$sitename = 'domain.com';
$address = inet_ntoa(inet_aton($sitename));
print $address;

It may be the fastest.

Brett_Tabke

WebmasterWorld Administrator brett_tabke us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 155 posted 6:31 pm on Aug 2, 2000 (gmt 0)

ouch. That is so easy it is embarassing.

Brett_Tabke

WebmasterWorld Administrator brett_tabke us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 155 posted 6:40 pm on Aug 2, 2000 (gmt 0)

Final edition:

use Socket;

&dresolve('webmasterworld.com');
&dresolve('searchengineworld.com');

sub dresolve {
$sitename =shift;
$ba =inet_aton($sitename);
$address ="Not valid";
if ($ba) {
$address = inet_ntoa($ba)
}
print "$sitename $address \n";
}


Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved