By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,042 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,042 IT Pros & Developers. It's quick & easy.

How to get the output from telnet commands in Perl?

P: n/a
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
Share this Question
Share on Google+
1 Reply


Expert
P: 70
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.