You have some logic errors. ie every time through the loop you are resetting the content of @cmd_output. Try this:
my $cs = Net::Telnet::Cisco->new(Host => '123.123.123.123'); $cs->login('login', 'password'); my $DEBUG = 1; open( FI, $ciscomm_conf ) || die $!; my( @oks, @fails); while(<FI>) { # remove newline chomp; # skip blank or comment lines next if m/^\s*#/ or m/^\s*$/; my $cmd = $_; $DEBUG && print "Sending $cmd\n"; my @cmd_output = $cs->cmd( String => $cmd,Timeout =>60 ); if ( @cmd_output ) { $DEBUG && print "Recv: @cmd_output\n"; push @oks, [ $cmd, \@cmd_output ]; } else { $DEBUG && print "ERR: " . $cs->errmsg . "\n"; push @fails, [ $cmd, $cs->errmsg ]; } } close FI; $cs->close; use Data::Dumper; print "OK\n", Dumper(\@oks); print "Fail\n", Dumper(\@fails);
cheers
tachyon
In reply to Re: Net::Telnet::Cisco usage
by tachyon
in thread Net::Telnet::Cisco usage
by chimni
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |