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