1
我一直在努力与我的代码段有一段时间了,不知道它。似乎与如何处理$ 1有关,但我找不到任何相关的东西。
正则表达式找到16640021并将它分配给数组中的一个位置。
my @one;
my @two;
my $articleregex = qr/\s*\d*\/\s*\d*\|\s*(.*?)\|/p; # $1 = article number
my $row = " 7/ 1| 16640021|Taats 3 IP10 |14-03-03| | | 1,0000|st | | 01| | N| 0|";
if ($row =~ /$articleregex/g) {
$one[0] = $1;
}
if ($row =~ /$articleregex/g) {
$two[0] = $1;
}
print $one[0];
print $two[0];
其输出
Use of uninitialized value in print at perltest3.pl line 13.
16640021
似乎之一$指定[0]以某种方式与该两个$干扰[0]。这对我来说似乎很奇怪,因为这两个变量和它们的名称不应以任何方式交互