If a machine has two network cards, which IP address do you want?
A machine doesn't have an IP addresss, a network card does.
Perhaps there are other ways to achieve what you want. I gather this is for Windows... perhaps you could just use an API call to get the name of the machine your script is running on? You can use Win32::API for that, in case there's no more specific (and maybe even better) module available. Don't get me wrong, I love Win32::API.
#!/usr/local/bin/perl -wl
use Win32::API;
my $GetComputerName = Win32::API->new("Kernel32", "GetComputerNameA",
+"PP", "N")
or die "Oops!";
my $computer = pack 'a256', '';
my $size = pack 'V', length($computer)-1;
$GetComputerName->Call($computer, $size) or die "Oops, I don't know wh
+o I am";
local $\ = "\n";
print unpack 'Z*', $computer;
But, wat are you actually trying to achieve? Are you trying to map specific volumes to drive letters, or something close? Because there are API calls available for those purposes, too, and you can use them from within Perl. |