470,594 Members | 1,556 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

perl telnet question ($telnet->cmd)

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
1 8389
GunnarH
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.

Similar topics

3 posts views Thread by Yannick Turgeon | last post: by
reply views Thread by Shuttermutt | last post: by
reply views Thread by CJ | last post: by
2 posts views Thread by Kai Thorsrud | last post: by
2 posts views Thread by kriz4321 | last post: by
2 posts views Thread by johnyboy1230987 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.