#!/usr/bin/perl # # This program parse extracts the IP address using ifconfig # # Author: Laurentiu Cucos # #--- get IP info in the known format: " inet addr:141.218.188.217 ....." $inp = `/sbin/ifconfig ppp0 | grep inet`; #--- remove the begining " inet addr:" $inp =~ s/[ \t]+inet addr://; #--- remove the end @ipList = split(/[ \t]/,$inp); #--- print the address. i.e. : 141.218.188.217 print "$ipList[0]\n";