in reply to Re^2: How to grab the telnet screen output?
in thread How to grab the telnet screen output?

Hi,

Normally, I use the waitfor to match a temporary changed "prompt", like a --more--. And, as you can read in the Net::Telnet with

($prematch, $match) = $obj->waitfor($matchop); $obj->print(q{a}) if( $prematch =~ m{f\. Advanced}sm ); $obj->print(q{b}) if( $prematch =~ m{l\. Command Line}sm );
you can use the $prematch to get the context.

Probably, your problem it's not with the TCP packets and the Net::Telnet, but with a premature match. Use the dump_log to inspect the flow of the session, and last, but not the least, use the perl -d to check each telnet interaction.