<p>Is there a clean and OS independent way to determine the local machine's IP addresses from Perl?</p>

<p>So far I have found the following solutions:</p>

<ul>
<li><p>parse the output of ifconfig and ipconfig (hard, different windows versions have different ipconfig outputs)</p></li>
<li><p>establish a network connection to a well-known IP and examine the socket's local IP address (won't work if I can't establish a connection and will determine only one IP address)</p></li>
</ul>

<p>Any better suggestion?</p>

use WMI?
Example of extracting IP addresses
(in Powershell, but it's pretty clear what's happening)
Example of accessing WMI from Perl
(not the same WMI functions, but again the process is reasonably clear)
EDIT: after a search on Google codesearch for Networkadapterconfiguration and language "perl":
Example looks like pretty much what you need
EDIT2: In fact the OCS code seems to contain code for most platforms to do this, so while there may be no one set of code that does this, you may be able to re-use their ideas. It's GPL'd, though.
For example,
here's the Solaris code
. Other bits cover BSD, Linux, MacOS...