内联(如果在需要操作员的预期位置发现了Scalar)(我对Perl不熟练)

时间:2019-02-28 15:54:47

标签: inline

创建了一个脚本,该脚本使用snmp更改了电缆调制解调器。一切正常,直到我尝试添加$ wifi eq yes关闭WIFI的功能。以下是我拥有的部分代码。

错误从这一行开始

if (!defined($wifi)) {
    $wifi = 'no';
    }

if ($model eq 'DG950A') {
    $result = $session->set_request(
       -varbindlist => [
          $oids{arrisRouterBssActive.12}, INTEGER, 2; if ($wifi eq 'yes')
          $oids{arrisRouterBssSSIDBroadcast.12}, INTEGER, 2 if ($wifii eq 'yes')
           $oids{arrisRouterRIPSendCMInterface}, INTEGER, 2,
         $oids{arrisRouterRIPAuthEnable}, INTEGER, 0,
         $oids{arrisRouterRIPRoutedSubnetEnable}, INTEGER, 1,
         $oids{arrisRouterRIPRoutedSubnetIP}, OCTET_STRING, hexip((split "/", $ip->first())[0]),
         $oids{arrisRouterRIPRoutedSubnetGWNetIP}, OCTET_STRING, hexip((split "/", $ip->first())[0]),
         $oids{arrisRouterRIPRoutedSubnetMask}, OCTET_STRING, hexip($mask),
           $oids{arrisRouterRIPEnable}, INTEGER, 1,
         $oids{arrisRouterFWEnabled}, INTEGER, 2,
         $oids{arrisRouterFWIPFloodDetect}, INTEGER, 2,
         $oids{arrisRouterFWAllowICMP}, INTEGER, 1,
         $oids{arrisRouterApplyAllSettings}, INTEGER, 1

        ]);

1 个答案:

答案 0 :(得分:0)

我将if语句移到了if语句的顶部 是if ($model eq 'DG950A') { changed to 如果($ model eq'DG950A'&& $ wifiwifi eq'是'){