#!/usr/bin/perl -w use strict; use IO::Socket; my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "210.212.226.195", PeerPort => "ssh(22)", ) || die "cannot connect"; sysread($remote, my $line, 4*1024) or die "couldn't read any data"; # one single attempt to read 4k of data print "$line\n";