I am having a frustrating problem extracting information from routers and switches.
I have tried several variations of code, but for some reason, I am not getting any results in my variables.
Here is a code snippet.
my @results = $telnetvar->cmd(String => 'show version',
Prompt => '/#/') ;
I have verified that the script opens the connection to the device, and authenticates. For whatever reason, when I try to print out the @results, like follows
foreach $resultline (@results) {
print OUTPUT "$resultline\n";
}
I never get any results in $resultline
I have written similar code elsewhere, and it still works, yet this is not working.
I've tried it using activePerl 5.8 on both Windows and Unix (Sun), and using Perl 5.003 on Unix, and also using the Net::Telnet and even the Net::Telnet::Cisco mods. No luck.
Any ideas on what I can try next?
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.