#!/bin/perl use strict; use warnings; use IO::Socket; my $destination_port = 5001; #change these how you will my $destination_address = "localhost"; my $socket = new IO::Socket::INET ( proto => "tcp", PeerAddr => $destination_address, PeerPort => $destination_port, ) or die "$!"; #send our "command" to the server print $socket "hello\n"; #See what the response is. In this case, we'll just keep #reading until the socket is closed remotely. while ( <$socket> ) { print; }