The following works for me:

  use Sys::Hostname;
  use Socket;

  $ip=gethostbyname(hostname());
  $theip=inet_ntoa($ip);

Jonathan

At 12:30 PM 1/22/2003 -0800, Jarvis, John wrote:
>you could try "system("ipconfig");"  but you'd have to parse some text such
>as this:
>
>
>Windows 95 IP Configuration
>
>0 Ethernet adapter :
>
>        IP Address. . . . . . . . . : 0.0.0.0
>        Subnet Mask . . . . . . . . : 0.0.0.0
>        Default Gateway . . . . . . :
>
>1 Ethernet adapter :
>
>        IP Address. . . . . . . . . : 0.0.0.0
>        Subnet Mask . . . . . . . . : 0.0.0.0
>        Default Gateway . . . . . . :
>
>2 Ethernet adapter :
>
>        IP Address. . . . . . . . . : 172.29.236.11
>        Subnet Mask . . . . . . . . : 255.255.255.128
>        Default Gateway . . . . . . : 172.29.236.1
>
>-----Original Message-----
>From: Jeff Slutzky [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, January 22, 2003 12:24 PM
>To: 'Jarvis, John'
>Cc: '[EMAIL PROTECTED]'
>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

Reply via email to