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

perl telnet question ($telnet->cmd)

P: 1
Hi ,
I have a problem doing manipulation (like split) in string comeing back from telnet commnd :

$HOST = 'xxx';
$USER = 'yyy20';
$PASS = 'yyy-pass';
#$telnet = Net::Telnet->new($HOST);
#$telnet->login($USER,$PASS);
$telnet = new Net::Telnet (Timeout => 30,
Prompt => '/[%#>] $/');
$telnet->open($HOST);
$telnet->login($USER, $PASS);
.....

$cmdstr_GSR_logname = "ls -ta ../log/ | grep abc_efg.$HOST | head -1";
(@lines) = $telnet->cmd($cmdstr_GSR_logname); # i tried with $lines[]
@line = split (/./, $lines); # i tried with split('.',$lines)

i tried every manipulation on @lines ($lines)
i cant do split on the string comeing back.

please help
Nov 19 '06 #1
Share this Question
Share on Google+
1 Reply


P: 83
I have a problem doing manipulation (like split) in string comeing back from telnet commnd :
If that is the problem you are having, why don't you post the content of the output rather than all that code?

$cmdstr_GSR_logname = "ls -ta ../log/ | grep abc_efg.$HOST | head -1";
(@lines) = $telnet->cmd($cmdstr_GSR_logname);
@line = split (/./, $lines);
But you haven't assigned anything to the variable $lines...

How about making Perl help you by adding
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
to the top of the program and declare the variables using my()?
Nov 19 '06 #2

Post your reply

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