use IO::Socket; my $sock = IO::Socket::INET->new( PeerAddr => $host, PeerPort => 23, Proto => 'tcp', Timeout => 3, ); if ( ! $sock ) { print( STDERR "$host: could not connect: $!" ); exit( 1 ); } #### my ( $r, $resp ); while (sysread($sock, $r, 1024) >= 1) { $resp .= $r; $resp =~ /prompt>/ and last; } print $sock "$username\n";