#! perl -slw use strict; my $ipConfig = do{ local $/; }; my( $hostName, @dnsIPs, $nodeType ); if( $ipConfig =~ m[Host Name . . . . . . . . . : (\S+)\s*\n]gc ) { $hostName = $1; } if( $ipConfig =~ m[DNS Servers . . . . . . . . :]gc ) { @dnsIPs = $ipConfig =~ m[(?:\s*([0-9.]+)\n)]gc; } if( $ipConfig =~ m[Node Type . . . . . . . . . : (\S+)\s*\n] ) { $nodeType = $1; } 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