Perl协助多个阵列线和拉动值

时间:2013-07-11 13:41:47

标签: perl

我是表格的新手,也是perl脚本,并需要以下方面的帮助:

我有一个脚本登录到Alcatel Lucent设备并启动以下内容:

my $cmd = "cltcmd shortloc metric 5 detect";
print "$cmd\n" if $debug1;
$s->cmd(String => "$cmd\n", Prompt  => "/$enableprompt/");
sleep 5;
$cmd="\n";

my @lines4 = $s->cmd(String => $cmd,
                Prompt  => "/$enableprompt/",
                Timeout => 10);
@lines4 = grep(/\S/, @lines4); <- Removes any blank lines.
foreach $lines4 (@lines4) {
    next if $lines4 =~ /sd12298a_LCT>|CLT operation completed.|LOG|Copper/; <- Remobed other non wanted text.
    print $lines4 if $debug1;
    $line4 = $lines4;
    print $line4;
}

如果我打印$ lines4,我得到正确的输出是2行文字:

cltcmd dmmall ohm 5 100

 Resistance (T-R) 999999999 (T-S) 999999999 (R-S) 999999999 Ohm

 999999999 Indicates out of range result

但如果我打印$ line,我得到的错误输出只有1行文字:

cltcmd dmmall ohm 5 100

 999999999 Indicates out of range result

我理解为什么会这样,但不知道如何修复它。

我想要做的是从数组中获取值并将它们放入以下各个变量中:

"Resistance"
"(T-R)"
"999999999"
"(T-S)"
"999999999"
"(R-S)"
"999999999"

但我没有运气。

谢谢,

0 个答案:

没有答案