http://www.perlmonks.org?node_id=642677


in reply to Help using Net::Telnet to use Rainbow

$f = $pop->waitfor('//'); print "$f\n";

From the documentation, waitfor just returns success or failure in scalar context. I'd say you probably want to call waitfor in list context:

($f) = $pop->waitfor('//'); print "$f\n";

... or even:

($f, $match) = $pop->waitfor('//'); print "$f$match\n";

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!

Replies are listed 'Best First'.
Re^2: Help using Net::Telnet to use Rainbow
by downer (Monk) on Oct 04, 2007 at 16:03 UTC
    I found the problem. yes, I need to call waitfor in list context, but instead of "\r\n.\r\n", I tried just "\n.\n" and it works fine.