my ( $r, $resp ); # kick the connection into life with a carriage return print $sock "\n"; # read in from the connection while (sysread($sock, $r, 1024) >= 1) { print( STDERR "At " . scalar(localtime(time())) . " received '$r'\n" ); $resp .= $r; $resp =~ /prompt>/ and last; } # print username to socket print( STDERR "Sending username..\n" ); print $sock "$username\n"; # debugging loop just to see what we're getting while (sysread($sock, $r, 1024) >= 1) { print( STDERR "At " . scalar(localtime(time())) . " received '$r'\n" ); $resp .= $r; }