#!/usr/bin/perl -w use strict; use IO::Socket; my $sock = new IO::Socket::INET (PeerAddr => 'foo', PeerPort => 1880, Proto => 'tcp' ); die "Could not create socket: $!\n" unless $sock; while (1) { print "Enter message: "; chomp (my $msg = ); print "Sending $msg\n"; print $sock "$msg\n"; $sock->flush; } close ($sock)