Dan Cox wrote:

> How would I get the IP address that is dynamically assigned to my modem
> and assign it to a variable? I'm using windows and would prefer not to
> use Win32::Registry. Thanks for any help.
> 
> Dan Cox

check out IO::Socket and IO::Interface. example:

#!/usr/bin/perl -w
use strict;

use IO::Socket;
use IO::Interface;

my $s = IO::Socket::INET->new(Proto => 'udp'); #-- anything else you want

#-- you might have more than one interface. just
#-- to be safe :-)
#--
for my $f ($s->if_list) {
       print "addr = ",$s->if_addr($f),"\n";
}

__END__

this way, you don't have to rely on Win32::Registry or paseing the 
`ipconfig` output manually. IO::Interface offers a few more add-ons that 
lets you query more than just the ip address. take a look at it.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to