-1
我使用以下perl腳本在每一行上查找比較(並將它們打印出來)。我試圖瞭解如何刪除其中一個配音行(保存當前文件或輸出到一個新的)。完整的腳本:http://pastebin.com/Vn1V0Uq2在Perl中刪除一行
while (@lines) {
my ($line, @found) = shift @lines;
my $re = qr/\Q$$line{data}\E$/; # search token
@lines = grep { # extract matches from @lines
not $$_{data} =~ $re && push @found, $_
} @lines;
if (@found) { # write the report
print "line $$_{line}: $$_{data}\n" for $line, @found;
print "\n";
}
}