Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How do I get the local internet IP address?

by Anonymous Monk
on Feb 09, 2001 at 19:54 UTC ( [id://57396]=note: print w/replies, xml ) Need Help??


in reply to How do I get the local internet IP address?

Same as above, but you can use this to resolve any address through the DNS setup (/etc/resolv.conf or the /etc/hosts file).

use Socket; my $hostname = "somehost.ext"; my @addr = inet_aton($hostname) or return "Unknown or invalid host."; my($a,$b,$c,$d) = unpack('C4', $addr(0)); #change the $addr() to brackets, this form filters brackets out. my $ip = "$a.$b.$c.$d"; print $ip;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://57396]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-20 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found