#!/usr/bin/perl use strict; use warnings; use IO::Socket; my ($host, $port) = ('111.111.111.111', '23'); my $command = "\$TEMP*"; my $socket = new IO::Socket::INET ( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', ); if (!$socket) { die "Unable to establish connection to $host\n"; } print $socket $command; $socket->getline; my $output = <$socket>; $socket->close; print "$output\n";