use strict; use IO::Socket; $| = 1; # flush output buffers immediately my ( $host ) = 'server'; my ( $port ) = 1234; # create the socket my $sock = IO::Socket::INET->new ( Proto => 'tcp', Type => SOCK_STREAM, PeerAddr => $host, PeerPort => $port ) or die "Cannot create socket : $!"; # so output goes to daemon immediately $sock->autoflush (1); print $sock "What is the time, Mr Wolf?\n";