Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

( #53700=categorized answer: print w/ replies, xml ) Need Help??

Q&A > network programming > How do I get the local internet IP address? contributed by kschwab

Works if Sys::Hostname comes up with a resolvable hostname.
use Sys::Hostname qw(hostname); # not strictly necessary; exports it b +y default use Socket; my($addr) = inet_ntoa( (gethostbyname(hostname()))[4] ); print "$addr\n";

Comment on Answer: How do I get the local internet IP address?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-07-26 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls