Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Need help getting output from Telnet into a string or array

by jhourcle (Prior)
on Mar 15, 2012 at 21:43 UTC ( #959867=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Need help getting output from Telnet into a string or array
in thread Need help getting output from Telnet into a string or array

I looks like someone else has done similar work.. In their example, they used:

 Prompt     => '/'.$switch.'.*?# /',

... where $switch is the name of the switch ... so the text of the prompt would be the switchname and maybe something else, ending in '# '

... but they also had to do extra checking to deal with some other differences between software versions, so this may be a more complex beast to deal with. Odds are, with any piece of networking gear that's out there, someone's already figured out how to interact with in in Perl, even if it means screen scraping HTML GUIs, so it's worth searching for "(hardware name) perl" in your preferred search engine.


Comment on Re^3: Need help getting output from Telnet into a string or array
Download Code
Re^4: Need help getting output from Telnet into a string or array
by TravisC (Novice) on Mar 16, 2012 at 15:28 UTC
    Thanks for the post. Right now I think it has more to do with my inexperience of passing values in a list context to an array than it does with the switch. I've tried creating the same desired result on other prompts (telnet on my local desktop) and got nothing but failure. Like I said in one of my previous posts, I'm able to pass the individual lines to $values but unable to pass the list context values to an @array. Any and all help would be greatly appreciated. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://959867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-12-28 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls