Hi all, thanks for your feedback. I also thought that LC_ALL is the 'right' way to do it because it has precedence over LANG, but when I tested it yesterday, only LANG did work. That's because LANG is automatically exported, LC_ALL not (on the machines available to me). So leaving the semicolon away made LC_ALL=C work. I'll update that, after testing it with the Solaris boxes.
Actually, the regular expressions are so fuzzy, they match any language that is available on my installation (cs, de, et_EE, fr, pt_BR - the other 129 languages have no localisation for ifconfig (net-tools here)). Right this approach is not perfect, but I thought the phrases 'Sample' and 'last resort' made clear, that this is not production code and one might need to fiddle a bit around with it? Would you suggest to make that more explicit?

The reason why I presented this sample was because it works for me and it shows another approach (TIMTOWTDI) that amend to the already given answers. If it works it works without the need to establish a connection and it lists all IPs, not only the one that leaves the (usually "default") route as when contacting a root name-server. This is handy if you're behind several layers of firewalls and in situations where you are interested in the local IP configuration.
If the intention of the question is more like How do I get the local internet IP address that currently connects my host to the IP a.b.c.d? (which is often not identical with the IP address other hosts would contact the local machine in return), then I would prefer this suggestion from tirwhan. Also because it doesn't require to install a non standard module beforehand.

Any other advice is appreciated. Thanks again.


In reply to Re: Answer: How do I get the local internet IP address? by Perlbotics
in thread How do I get the local internet IP address? by Anonymous Monk

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.