#! perl -slw use strict; my $ipconfig = do{ local $/; }; $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