use strict; my @nic = qx |ifconfig -a| or die ("Can't get info from ifconfig: ".$!); my $skip_to_next_if = 0; my $device; foreach (@nic){ if (/^fjgi([\d.]+)/){ # ^ +: 1 or more $device = $1; $skip_to_next_if = 0; } next if $skip_to_next_if; if (/inet ([\d.]+)/){ my $ip = $1; print "Device $device has the IP Address of $ip\n"; $skip_to_next_if = 1; } } # $ip is now out of scope...