[tpm] how to delete array entries en-passant

Fulko Hew fulko.hew at gmail.com
Wed Jun 30 08:06:49 PDT 2010

As the subject line asks...
what I'd like to do is something like

foreach (@array) {
    if (condition) {
        splice @array, this_entry, 1;
    do processing on this entry;

@array now contains a sub-set of the original
that I can now further process

'delete' might work, but the words say delete on arrays is deprecated
and it still doesn't give me the delete 'this' entry concept, because
it too works on an index.

I'd like to do it without creating another array, because I like
'premature optimizations' and because I think it would make the
code more readable.  :-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20100630/e65421c7/attachment.html>

More information about the toronto-pm mailing list