Take the problem in chunks using /gc options. This assumes you only want the dns ips in the array, but you if you need the other bits that can be done using the same method.
#! perl -slw use strict; my $ipconfig = do{ local $/; <DATA> }; $ipconfig =~ m[DNS Servers . . . . . . . . :]gc and my @dnsIPs = $ipconfig =~ m[(?:\s*([0-9.]+)\n)]g; print join '|', @dnsIPs; __DATA__ Host Name . . . . . . . . . : LAPTOP.no.cox.net DNS Servers . . . . . . . . : 205.152.132.211 181.171.2.11 10.10.10.1 Node Type . . . . . . . . . : Broadcast
Gives
P:\test>junk 205.152.132.211|181.171.2.11|10.10.10.1
In reply to Re: reading lines
by BrowserUk
in thread reading lines
by spill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |