my $test = "router Unnamed 161.53.60.233 9001 0 9030"; $test =~ /^router\s(.*)\s(.*)\s(.*)\s(.*)\s(.*)$/; $name = $1; $ip = $2; print "$ip $name\n";