Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

UFF :S sorry for that my mistake. Any way i use it but as noob i cant figuring still what im doing wrong ... for now im not in the work ( medical issue ) and i cant test it ... im trying now at home with some improvisation and here is what i got using this code

use Net::Telnet::Cisco; use strict; use warnings; use diagnostics; my %users = ("6" =>"none", ); my %pwds = ("6" =>"thispass", ); my $i = 4; for ($i; $i <= 10; $i++){ my $device = "10.10.$i.1"; my $pe = $i; my $curpwd = "admin"; if (defined $pwds{$i}) { $curpwd = $pwds{$i}; } if ($users{$i} eq "none") { my $session->login(Password => $curpwd); } else { my $session->login(Name => 'admin', Password => $curpwd, Input_log + => "perllogrouter/router$i.log",); } $session->cmd ("sh running-config | redirect +oba$pe.txt"); $session->close; }
and here is what i get from that ..
C:\Users\mydesktop\Desktop\Perl>perl Global symbol "$session" requires explicit package name at +line 24. Global symbol "$session" requires explicit package name at +line 25. Execution of aborted due to compilation errors.
After i put "my" in session at line 24 and 25 i get this
C:\Users\mydesktop\Desktop\Perl>perl "my" variable $session masks earlier declaration in same scope at teln line 25. Useless use of private variable in void context at line 26. Use of uninitialized value within %users in string eq at li +ne 19. Can't call method "login" on an undefined value at line 22. C:\Users\mydesktop\Desktop\Perl>
So pls can you suggest what im doing wrong ... im now im noob and this is easy but the time is not on my side this few weeks. Im trying to read this book but im still at Strict,Warnings,and Diagnostics Chapter3 Variables :) and yes we all understand variables but i just fall in love with perl and i dont like to skip any chapter or something :) love is come again :) .... tnx in advanced for the support and any help you gave me .....

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

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2022-06-25 11:51 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (82 votes). Check out past polls.