Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by kschwab (Priest)
on Jan 23, 2001 at 19:28 UTC ( #53700=categorized answer: print w/replies, xml ) Need Help??

Q&A > network programming > How do I get the local internet IP address? - Answer 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";

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-01-16 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (182 votes). Check out past polls.

    Notices?