[Ilugc] Find IP address of a machine

  • From: arunvelusamy@xxxxxxx (Arun Velusamy)
  • Date: Mon Oct 23 18:14:26 2006

Hi all,
    I have a scenario where my perl program has to find the IP address 
of the machine.  I didn't know how to achieve this in perl (yet to look 
cpan though), so i tried doing it through shell commands.  The usual way 
we do it is by 'ifconfig'  and here is how i achieved that,

       `/sbin/ifconfig | grep inet | awk '{print $2}' | sed 's#addr:##g'`


If anyone of you could achieve this, through a simple means, plz let me 
know.

Regards,
Arun Velusamy

Other related posts: