my @resp; my @all_resp; my $s = new IO::Socket::INET( PeerAddr => 'localhost', Peerport => 4000, Proto => 'tcp', Timeout => 4); print "before unless"; unless ($s) { die "unable to connect..." } sleep 1; # we are connected, so just start sending commands print $s "auth admin 555555\r\n"; sleep 1; @resp = <$s>; # expect one line response push (@all_resp, @resp); print $s "voo allowed_ips\r\n"; sleep 1; @resp = <$s>; push (@all_resp, @resp); print @all_resp;