$ifconfig = "ifconfig -a"; @nic = qx |$ifconfig| or die ("Can't get info from ifconfig: ".$!); foreach (@nic){ if (/^fjgi([\d.])/){ $device = $1; if (/inet ([\d.]+)/){ print "test $1\n"; $ip = $1; } print "Device $device has the IP Address of $ip\n"; } }