471,896 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,896 software developers and data experts.

How to get the output from telnet commands in Perl?

Expand|Select|Wrap|Line Numbers
  1. use Net::telnet
  2. telnet->open($host);
  3. telnet->logint("rrot","rut"
  4. $a=telnet->cmd("ls");
using telnet i am running this command to remote machine its is connecting to remote machine.
but the output of "ls" is not coming in $a.
a is having the status of the ls command it is not having results .a is having 0 or 1.
ouput is not coming in a
Nov 5 '10 #1
1 5365
70 Expert
Try to capture the cmd output into an array variable instead of a scalar variable:

Expand|Select|Wrap|Line Numbers
  1. my @lines = $telnet->cmd("ls");
This is discussed in the cmd section of the Net::Telnet documentation.
Nov 5 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by nicolas | last post: by
5 posts views Thread by Greg Martz | last post: by
5 posts views Thread by pbd22 | last post: by
1 post views Thread by afelotreyu | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.