这是为什么产生错误:Perl的使用,以代替未初始化值的
在替代(S ///)使用未初始化值$比赛...
my $sub = 0; #added
my $m; #added
open (FH1, "<FILE1.txt") || die $!;
open (FH2, "<FILE2,txt") || die $!;
my @strings = (<FH2>); #each line of the file into an array
close FH2 or die $!;
my $here;
while (my $url = <FH1>) {
chomp $url;
foreach my $sub (@strings) {
my $repeat = 1;
while ((my $m = $_) =~ s|(?<![/])(?:[/](?![/])[^/]*){$repeat}[^/]*\K|$sub|) #<-- Error states the error is occurring here
{
print "$m\n";
$repeat++;
push(@{ $here->{$url} }, $m);
}
}
}
有肯定是在文件中的东西(因为我可以打印foreach
循环中的每一行),并且正则表达式替换在我试图将其移入此程序之前已经在其自己的程序中进行过测试。
这是我明显忽略的东西吗?
你的帮助会非常赞赏,非常感谢
感谢**缩进你的代码**正确 – 2013-02-27 17:00:25
歉意,感谢您的抬头 – 2013-02-27 17:09:22