use IO::Socket; local ($hSocket); local (@asWhoIsOutput); eval { $hSocket = IO::Socket::INET->new(Proto => "tcp", Timeout => "10", PeerAddr => $sWhoIsHost, PeerPort => "43"); if ($hSocket) { $hSocket->autoflush(1); @asWhoIsOutput = <$hSocket>; close ($hSocket); } }; if(@asWhoIsOutput) { for (@asWhoIsOutput) { print $_; } }