I've not used it myself yet, but CPAN module Sys::HostIP appears to be what you're looking for.   From the module source:
NAME Sys::HostIP - Try really hard to get IP addr. SYNOPSIS use Sys::HostIP; $ipaddr= hostip; # get (text) dotted-decimal ip use IO::Socket; use Sys::Hostname; # Have to try non-cannonical name first, since there # is a better chance the computer knows itself than # of DNS knowing it. if($^O eq 'MSWin32') # check ipconfig.exe # (Which does all the work of checking the registry, # probably more efficiently than I could.) # check nbtstat.exe # (Which does all the work of checking WINS, # more easily than Win32::AdminMisc::GetHostAddress().) # check /etc/hosts entries # check /etc/lmhosts entries # (It will only be here if the file has been modified since th +e # last WINS refresh, which is unlikely, but might as well try. +) elsif($^O=~ /IX|ux/i) # check /etc/hosts entries # last resort: ping (which can be very slow)
Ya just gotta love cpan.
    cheers,
    Don
    striving for Perl Adept
    (it's pronounced "why-bick")

In reply to Re: Finding your IP address with Perl (Sys::HostIP) by ybiC
in thread Finding your IP address with Perl by $ENV{REMOTE_USER}

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.