Next | Tie::File | 6 |
How do I delete a line in a file?
for $n (0 .. $#LINE) { if (is_snide_answer_to_FAQ($LINE[$n - $spliced])) { splice @LINE, $n - $spliced, 1; $spliced++; } }
or:
for $n (reverse 0 .. $#LINE) { if (is_snide_answer_to_FAQ($LINE[$n])) { splice @LINE, $n, 1; } }
or:
@snide = grep is_snide_answer_to_FAQ($LINE[$_])), 0..$#LINE; for (reverse @snide) { splice @LINE, $_, 1 }
Next | . | Copyright © 2002 M. J. Dominus |