469,271 Members | 1,447 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

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 5075
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.