use IO::Socket; my $sock = new IO::Socket::INET ( PeerAddr => 'localhost', PeerPort => 10000, Proto => 'tcp', ); die "could not create socket\n" unless $sock; print $sock "Hello there\n"; close($sock);