#!/usr/local/bin/perl use IO::Socket; # create a tcp connection to the specified host and port $server = IO::Socket::INET->new( Proto => "tcp", PeerAddr => 'localhost', PeerPort => '6969' ), or die "can't connect to server: $!"; print "[Client $0 connected to server]\n"; print $server "READY\n"; while (defined ($this_line = <$server>)) { print STDOUT $this_line; if ($this_line =~ /STOP/i) { last; } } close $server;