Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi i was trying the suggestion you gave me and i have some problems or nubs questions ... here is what i have

use Net::Telnet::Cisco; for ($i = 4; $i <= 10; $i++){ $device = "172.16.$i.251"; my $pe = $i; my %users = ("6" =>"none", ); my %pwds = ("6" =>"thispass", ); my $curpwd = "admin"; if (defined $pwds{$i}) { $curpwd = $pwds{$i}; } if ($users{$i} eq "none") { $session->login(Password => $curpwd); } else { $session->login(Name => 'admin', Password => $curpwd, Input_log => " +perllogrouter/router$i.log",); } $session->cmd ("sh running-config | redirect ftp://172.25.1.101/proba +$pe.txt"); $session->close; }

and this is the error i get when i try to run this

C:\Users\mydesktop\Desktop\Perl>perl telnet.pl

Name "main::device" used only once: possible typo at telnet.pl line 5.

Use of uninitialized value within %users in string eq at telnet.pl line 16.

Can't call method "login" on an undefined value at telnet.pl line 19.

C:\Users\mydesktop\Desktop\Perl>

Any suggestion about this because im still learning the perl and some of the errors that i get im not quite sure what are telling me


In reply to Re^2: Telnet Cisco routers by IvanAK
in thread Telnet Cisco routers by IvanAK

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-23 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found