in reply to Re^4: How can I delete an element in a foreach cycle?
in thread How can I delete an element in a foreach cycle?
... mark the element as "undef" in foreach cycle and then delete it throught [sic] a grep.
There are indeed many paths in programming as in life, and if you are happy with the one you have chosen, then so, too, I, and wish you well of it.
But I must say I don't understand your allegiance to for(each). The only reason I can see for using it is to process the array 'in-place': grep will (I think; haven't researched or tested this) create a temporary array, thus possibly effectively doubling the size of the array being processed; thus, if the array just fits into available memory to begin with, you will run into problems.
But if you're going to use a grep also, why not just use a grep period? (However, this question is just idle curiosity.)
|
|---|