UNIX Perl – Get local IP with ifconfig
Replace ETH0 with the interface you need..
my $IP = `ifconfig eth0| awk ‘/dr:/{gsub(/.*:/,””,\$2);print\$2}’`;
$IP =~ s/\s+$//;
Replace ETH0 with the interface you need..
my $IP = `ifconfig eth0| awk ‘/dr:/{gsub(/.*:/,””,\$2);print\$2}’`;
$IP =~ s/\s+$//;