1
如何更改此代碼插入行如果丟失而不刪除現有的?如何在使用Tie :: File時有條件地插入行?
tie my @lines, 'Tie::File', $fn or die "could not tie file: $!";
for (my $i = 0; $i < @lines; $i++) {
if ($ln_title == 0) {
if ($i < $#lines and $lines[$i] =~ /(\s+TRACK \d\d .*)$/) {
$lines[$i+1] = ' TITLE ""';
}
}
}
untie @lines;
是。這正是我所期待的。 非常感謝。 – thebourneid 2010-06-14 04:18:25