#! perl -slw use strict; my $ipConfig = do{ local $/; }; my $hostName = $1 if $ipConfig =~ m[Host Name . . . . . . . . . : (\S+)\s*\n]gc; my @dnsIPs = $ipConfig =~ m[(?:\s*([0-9.]+)\n)]gc if $ipConfig =~ m[DNS Servers . . . . . . . . :]gc; my $nodeType = $1 if $ipConfig =~ m[Node Type . . . . . . . . . : (\S+)\s*\n]; print $hostName, $/, join( ' | ', @dnsIPs), $/, $nodeType; __DATA__ Host Name . . . . . . . . . : LAPTOP.no.cox.net DNS Servers . . . . . . . . : 205.152.132.211 181.171.2.11 10.10.10.1 Node Type . . . . . . . . . : Broadcast