Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2016-10-24 08:27 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (304 votes). Check out past polls.