Acclaimed Contributor Acclaimed Contributor
Re: Perl and Net::Telnet
Hi Jeff:

I'm going to give you the most valuable Perl lesson I know: add the -w to generate warnings and use strict:

viz:

#!/usr/bin/perl -w

use strict;

use Net::Telnet ();
my $t = new Net::Telnet (Timeout => 5, Errmode=>'die');
$t->open("sbr-3524-1.conpap.com");
$t->waitfor('/Password\: /i');
$t->print("xxxxxxx");
$t->waitfor('/SBR-3524-1\>/i');
my @lines = $t->cmd("help");
print "Lines: ",@lines,"\n";
$t->close();

Note that with -w you will see that your \s is not a recognized pattern. I changed your "who" to "help" because the "who" command is not recoginized on a Catalyst 5500 although I assume "who" is a valid command on a 3524.

If it ain't broke, I can fix that.