in reply to Common Perl Pitfalls
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];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Common Perl Pitfalls
by Joe_ (Beadle) on Apr 09, 2012 at 23:24 UTC | |
Re^2: Common Perl Pitfalls
by Joe_ (Beadle) on Apr 09, 2012 at 23:50 UTC | |
by JavaFan (Canon) on Apr 10, 2012 at 13:22 UTC | |
by Joe_ (Beadle) on Apr 10, 2012 at 18:10 UTC |
In Section
Meditations