Deleting some array elementsI'd write that as:
If only because your splice solution can be quadratic worst case, while the above is linear (assuming should_delete has a running time bounded by a constant).@array = @array[grep {!should_delete($_)} 0..$#array];
In reply to Re: Common Perl Pitfalls
by JavaFan
in thread Common Perl Pitfalls
by Joe_
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |