use IO::Socket; $sock = IO::Socket::INET->new ( PeerAddr => 'localhost', PeerPort => '18080', Proto => 'tcp', ); if($sock->connected){ print "Ex->"; while(chomp($in = )){ print $sock "$in\n"; } } close($sock);