use warnings; use IO::Socket; my $sock = new IO::Socket::INET ( PeerAddr => '192.168.x.xx', PeerPort => '12345', Proto => 'tcp', ); die "Could not create socket : $!\n" unless $sock; print $sock "Hello there!\n"; close($sock);