perl - 散列[关联数组?]上的Perl语法错误

标签 perl syntax hash syntax-error

当我尝试运行包含以下代码的脚本时出现错误。 该错误是Fingerprint.pm第131行的语法错误,在“{” 附近[类似于下面的8]。我没有Perl的经验,我在这里缺少什么吗?

my @ruleset = (
{ fingerprint=>$iq[0], header=>$qy[0], query=>$ntc[0], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[1], query=>$ntc[1], ruleset => [
{ fingerprint=>$iq[2], header=>$qy[2], query=>$ntc[2], ruleset => [
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.2.2-P3",version=>"VERSION"}, }


{ fingerprint => $iq[1], result => { vendor =>"VENDOR", product=>"BIND 9.2.0", version=>"VERSION"}, #This is line 131, the error line
}]}, 


{ fingerprint => $iq[3], result => { vendor =>"VENDOR", product=>"BIND 9.2.1",version=>"VERSION"}, }
]},


{ fingerprint => $iq[4], result => { vendor =>"VENDOR", product=>"BIND 9.2.0rc3",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[5], header=>$qy[0], query=>$ntc[0], ruleset => [
{ fingerprint=>$iq[2], header=>$qy[2], query=>$ntc[2], ruleset => [
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.1.2",version=>"VERSION"}, }
{ fingerprint => $iq[1], result => { vendor =>"VENDOR", product=>"BIND 9.1.1",version=>"VERSION"}, }
]},
{ fingerprint => $iq[6], result => { vendor =>"VENDOR", product=>"BIND 9.1.3",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[7], header=>$qy[0], query=>$ntc[0], ruleset => [
{ fingerprint=>$iq[8], header=>$qy[3], query=>$ntc[3], ruleset => [
{ fingerprint=>$iq[9], header=>$qy[2], query=>$ntc[2], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[4], query=>$ntc[4], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[5], query=>$ntc[5], ruleset => [
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.2.5",version=>"VERSION"}, }
{ fingerprint => $iq[1], result => { vendor =>"VENDOR", product=>"BIND 9.2.6",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.2.9",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.2.4",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.2.7",version=>"VERSION"}, }
{ fingerprint => $iq[3], result => { vendor =>"VENDOR", product=>"BIND 9.2.8",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[10], header=>$qy[3], query=>$ntc[3], ruleset => [
{ fingerprint=>$iq[11], header=>$qy[6], query=>$ntc[6], ruleset => [
{ fingerprint=>$iq[12], header=>$qy[1], query=>$ntc[1], ruleset => [
{ fingerprint=>$iq[13], header=>$qy[7], query=>$ntc[7], ruleset => [
{ fingerprint => $iq[14], result => { vendor =>"VENDOR", product=>"BIND 9.4.1",version=>"VERSION"}, }
{ fingerprint => $iq[15], result => { vendor =>"VENDOR", product=>"BIND 9.4.2",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[16], header=>$qy[7], query=>$ntc[7], ruleset => [
{ fingerprint=>$iq[17], header=>$qy[8], query=>$ntc[8], ruleset => [
{ fingerprint=>$iq[15], header=>$qy[9], query=>$ntc[9], ruleset => [
{ fingerprint => $iq[9], result => { vendor =>"VENDOR", product=>"BIND 9.6.0",version=>"VERSION"}, }
{ fingerprint => $iq[18], result => { vendor =>"VENDOR", product=>"BIND 9.4.0, BIND 9.4.0b4, BIND 9.4.3, BIND 9.5.0, BIND 9.5.1, ",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.4.0a5",version=>"VERSION"}, }
]},
{ fingerprint => $iq[19], result => { vendor =>"VENDOR", product=>"BIND 9.5.2, BIND 9.6.1, BIND 9.6.2, BIND 9.7.0, BIND 9.7.1, ",version=>"VERSION"}, }
]},
]},
{ fingerprint=>$iq[1], header=>$qy[1], query=>$ntc[1], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[4], query=>$ntc[4], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[10], query=>$ntc[10], ruleset => [
{ fingerprint=>$iq[2], header=>$qy[11], query=>$ntc[11], ruleset => [
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.3.1",version=>"VERSION"}, }
{ fingerprint => $iq[1], result => { vendor =>"VENDOR", product=>"BIND 9.3.3",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[1], header=>$qy[11], query=>$ntc[11], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[12], query=>$ntc[12], ruleset => [
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.3.5",version=>"VERSION"}, }
{ fingerprint => $iq[1], result => { vendor =>"VENDOR", product=>"BIND 9.3.6-P1, BIND 9.3.6, ",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.3.2",version=>"VERSION"}, }
]},
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.3.0",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"BIND 9.3.4",version=>"VERSION"}, }
]},
]},
{ fingerprint => $iq[20], result => { vendor =>"VENDOR", product=>"BIND 9.6.3, BIND 9.7.3, ",version=>"VERSION"}, }
]},
]},
{ fingerprint=>$iq[21], header=>$qy[0], query=>$ntc[0], ruleset => [
{ fingerprint=>$iq[17], header=>$qy[1], query=>$ntc[1], ruleset => [
{ fingerprint=>$iq[22], header=>$qy[13], query=>$ntc[13], ruleset => [
{ fingerprint => $iq[23], result => { vendor =>"VENDOR", product=>"NSD 3.0.0, NSD 3.0.1, NSD 3.0.2, NSD 3.0.3, NSD 3.0.4, NSD 3.0.5, NSD 3.0.6, NSD 3.0.7, NSD 3.0.8, NSD 3.1.0, NSD 3.1.1, NSD 3.2.0, NSD 3.2.1, NSD 3.2.2, NSD 3.2.3, NSD 3.2.4, NSD 3.2.5, NSD 3.2.6, NSD 3.2.7, NSD 3.2.8, ",version=>"VERSION"}, }
{ fingerprint => $iq[19], result => { vendor =>"VENDOR", product=>"NSD 2.1.3, NSD 2.1.4, NSD 2.1.5, NSD 2.2.0, NSD 2.2.1, NSD 2.3.6, NSD 2.3.7, ",version=>"VERSION"}, }
]},
{ fingerprint => $iq[19], result => { vendor =>"VENDOR", product=>"NSD 1.2.0, NSD 1.2.1, NSD 1.2.2, NSD 1.2.3, NSD 1.2.4, ",version=>"VERSION"}, }
]},
{ fingerprint => $iq[24], result => { vendor =>"VENDOR", product=>"NSD 2.0.0, NSD 2.0.1, NSD 2.0.2, NSD 2.1.0, NSD 2.1.1, NSD 2.1.2, NSD 2.3.0, NSD 2.3.1, NSD 2.3.2, NSD 2.3.3, NSD 2.3.4, NSD 2.3.5, ",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[25], header=>$qy[0], query=>$ntc[0], ruleset => [
{ fingerprint => $iq[3], result => { vendor =>"VENDOR", product=>"BIND 9.2.0rc6",version=>"VERSION"}, }
{ fingerprint => $iq[9], result => { vendor =>"VENDOR", product=>"BIND 9.2.2",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[26], header=>$qy[0], query=>$ntc[0], ruleset => [
{ fingerprint=>$iq[1], header=>$qy[14], query=>$ntc[14], ruleset => [
{ fingerprint=>$iq[16], header=>$qy[7], query=>$ntc[7], ruleset => [
{ fingerprint=>$iq[16], header=>$qy[9], query=>$ntc[9], ruleset => [
{ fingerprint=>$iq[2], header=>$qy[15], query=>$ntc[15], ruleset => [
{ fingerprint => $iq[27], result => { vendor =>"VENDOR", product=>"Unbound 1.4.7",version=>"VERSION"}, }
{ fingerprint => $iq[28], result => { vendor =>"VENDOR", product=>"Unbound 1.4.5, Unbound 1.4.6, Unbound 1.4.8, ",version=>"VERSION"}, }
]},
{ fingerprint => $iq[19], result => { vendor =>"VENDOR", product=>"Unbound 1.4.10",version=>"VERSION"}, }
]},
{ fingerprint => $iq[15], result => { vendor =>"VENDOR", product=>"Unbound 1.4.3",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[29], header=>$qy[7], query=>$ntc[7], ruleset => [
{ fingerprint=>$iq[16], header=>$qy[9], query=>$ntc[9], ruleset => [
{ fingerprint => $iq[16], result => { vendor =>"VENDOR", product=>"Unbound 1.3.0",version=>"VERSION"}, }
{ fingerprint => $iq[30], result => { vendor =>"VENDOR", product=>"Unbound 1.3.1, Unbound 1.3.2, Unbound 1.3.3, ",version=>"VERSION"}, }
]},
{ fingerprint=>$iq[15], header=>$qy[9], query=>$ntc[9], ruleset => [
{ fingerprint => $iq[28], result => { vendor =>"VENDOR", product=>"Unbound 1.3.4",version=>"VERSION"}, }
{ fingerprint => $iq[27], result => { vendor =>"VENDOR", product=>"Unbound 1.4.0",version=>"VERSION"}, }
]},
]},
{ fingerprint => $iq[30], result => { vendor =>"VENDOR", product=>"Unbound 1.4.1, Unbound 1.4.4, Unbound 1.4.9, ",version=>"VERSION"}, }
]},
{ fingerprint => $iq[2], result => { vendor =>"VENDOR", product=>"Unbound 1.4.2",version=>"VERSION"}, }
]},
{ fingerprint => $iq[31], result => { vendor =>"VENDOR", product=>"BIND 9.2.3",version=>"VERSION"}, }
);

最佳答案

看起来像是前一行末尾缺少的逗号(在您的示例中为第7行)

关于perl - 散列[关联数组?]上的Perl语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6580816/

相关文章:

javascript - 将数组传递给 JavaScript 回调

ruby-on-rails - 错误率: FasterCSV to hash

Perl - 使用指针和索引进行二进制解包

ruby - 将错误对象分配给 `rescue` 方法的变量时使用的语法 (=>) 是什么?

c - 在 C 中,冒号在声明中意味着什么?

ruby-on-rails - 是否有更好的 Ruby 或 Rails 习惯用法来检查嵌套哈希中是否存在值?

perl - 如何写出或读入 Perl 散列的数组?

perl - 使用 perl 解码 unicode 转义字符

perl5 方法测试 "can"在新版本中无法正常工作

perl - 我怎样才能对这个哈希数组进行排序?