DiGregorio, Dave wrote:
Help please, I am trying to get the IP address of the host PC into a perl
script.  I tried using Gethostbyname() without success.  I have a Bluetooth
adapter connected to this PC and when I ping host name it returns the IP
address of the BT adapter.  Ipconfig shows the 2 ethernet adapters and the
Bluetooth adapter uses Ethernet adapter#2.  Is there another way to get IP
address from the system?

$ perl -mstrict -we 'use IO::Socket;use Sys::Hostname;print inet_ntoa((gethostbyname(hostname()))[4]),"\n";' 192.168.0.4 $

perldoc IO::Socket
perldoc Sys::Hostname

HTH :)


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to