Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl telnet looping problem

Thread Tools

Perl telnet looping problem

Posts: n/a
Can someone look at the code below and tell me whats going on?

Here is the problem. I can successfully telnet one of our routers and
successfully put in a command in the while statement, but when the loop goes
around a second time, it gives me:
"pattern match timed-out at c:\ line 21"

It can't get past the waitfor statement for a prompt the 2nd go around in
the loop.


================================================== ====

use Net::Telnet;
use constant PASS=>'password';

$telnet = new Net::Telnet (Timeout=>25);


$telnet->waitfor('/assword: /');

while ($i < 6400) {

print "LOOPED!!!\n"; 'for troubleshooting purposes
$prompt = $telnet->waitfor('/> /');
print "MADE IT PAST PROMPT\n"; 'for troubleshooting purposes

$statement=('<command goes here>');

print "PORT FILTER ADDED\n"; 'for troubleshooting



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
looping in array vs looping in a dic Python 5 09-20-2012 11:58 PM
Telnet - attempting to initiate a telnet session within an established telnet session Carcarius Ruby 0 12-06-2007 03:26 AM
Need to talk to a telnet server and send a telnet break Jim Isaacson C Programming 5 11-05-2004 09:17 PM
Enumerate question: Inner looping like in Perl Pekka Niiranen Python 5 10-31-2004 10:28 AM
How can I telnet when I dont have specific access to a telnet client Jack B. Pollack Computer Support 4 07-24-2003 08:58 PM