Or a nifty one-liner if you really want to compact it, like this:

my $ipc = (`ipconfig` =~ m/IP Address[ \.]+: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)[0];


Paul

>>> "Harald Wopenka" <[EMAIL PROTECTED]> 1/22/2003 12:45:00 PM >>>
Hi,

$ipc=`ipconfig`;
$ipc=substr($ipc,index(lc($ipc),lc("ip ad")));
$ipc=(split(/\r/,((split(/: /,$ipc))[1])))[0];
print $ipc;

This is what I use. Maybe you can make it shorter with regular
expressions...
("ip ad" is for english windows)

Harry

----- Original Message -----
From: "Jeff Slutzky" <[EMAIL PROTECTED]>
To: "'Jarvis, John'" <[EMAIL PROTECTED]>
Cc: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 9:24 PM
Subject: RE: Get IP Address


> I'm trying to accomplish this from within a perl script.
>
> -----Original Message-----
> From: Jarvis, John
> Sent: Wednesday, January 22, 2003 1:56 PM
> To: '[EMAIL PROTECTED]' 
> Cc: '[EMAIL PROTECTED]' 
> Subject: RE: Get IP Address
>
> For local access, try typing 'WINIPCFG' at the command prompt; don't
forget
> to select the right "interface" from the picklist.
>
> If it's a remote host, how are you contacting it now?
>
> Cheers
> -----Original Message-----
> From: Jeff Slutzky [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 22, 2003 11:32 AM
> To: '[EMAIL PROTECTED]' 
> Subject: Get IP Address
>
>
> Is there a quick and dirty way to get the IP address for a Win9x PC?
>
> --------------------------------------------------------------------------
--
> ----
> Jeffrey L. Slutzky
> Manager System Administration
> 402.501.4860 (Direct)
> 402.850.4860 (Cell)
> Affinitas - Latin for "Relationship"
> Helping Businesses Acquire, Retain, and Cultivate Customers
> Visit us at http://www.affinitas.net 
> ------------------------------------------------------------------
> 1015 N. 98th Suite 100
> Omaha, NE 68114
> ------------------------------------------------------------------
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED] 
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED] 
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 
>

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED] 
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to