in reply to how do I read from a socket one byte at a time?

If you aren't interested in the gory details of sockets, Net::Telnet might be interesting for you.

Here's an example that does what I think you want. It doesn't read character by character, but it does print output as it reaches the buffer, rather than waiting for a newline:

#!/usr/bin/perl # unbuffer STDOUT, so you can watch the # traceroute output "realtime" select STDOUT;$|=1; use Net::Telnet; my($host)="yourhost"; my($trace)="www.cnn.com"; my($username)="username"; my($passwd)="password"; my($t)=Net::Telnet->new(Host => $host); defined($t) or die; $t->login($username, $passwd) or die; $t->print("traceroute $trace") or die; while (defined($data = $t->get())) { print $data; # supposing your prompt is a dollar # sign and that doesn't ever appear in # traceroute output... last if ($data =~ /\$/); } print "\n"; $t->print("exit"); $t->close;
Good luck...