它的意思是,要么@destination
,@IP_one_1
,@IP_one_2
,或@reached
尚未定义的元素之一,或已被赋值为undef
。您可能需要检测(并阻止)来源处未定义的值,或者稍后期待和处理它们。由于你有warnings
启用(这是一件好事),Perl提醒你,你的代码试图连接一个字符串,其中一个值被连接的值是未定义的。
您可能会调查的一个示例是一个或多个数组的总大小与其他数组不同。例如,如果@IP_one_2
的元素数少于其他元素,或者$num2
的值大于任何数组中的元素数。
地点靠近你的脚本的顶部以下并再次运行它:
use diagnostics;
当我运行下的警告和诊断下面的一行:
$ perl -wMdiagnostics -e '$a=$a; print "$a\n"'
我得到以下输出,如果你添加use diagnostics;
,你会得到类似的东西......当你第一次学习Perl的警告时,一个非常有用的工具。
Use of uninitialized value $a in concatenation (.) or string at -e line 1 (#1)
(W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl will try to tell you the name of the variable (if any) that was undefined. In some cases it cannot do this, so it also tells you what operation you used the undefined value in. Note, however, that perl optimizes your program anid the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program.
和我行63是由for循环 – user1581917 2012-08-15 20:29:50
这是不可能告诉一个哪些值未根据您向我们显示的内容初始化。使用Perl调试器或添加一些'print'语句,并检查在(非常长)字符串文字中引用的所有变量的值;其中之一是“undef”。 – 2012-08-15 20:33:22
另外还有一个提示:也许最好将5个数组中的数据重组为哈希数组?我想,处理起来会更清洁。 – raina77ow 2012-08-15 20:37:47