NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
My head still hurts (Score:1)
First of all:
But that is still terrible, if you’ll excuse my frankness. Somewhere in the middle of a loop you surreptitiously modify the array you are iterating over with
splice. Is the fact that you might end up over- or undershooting the end of the array (because the list of indices was generated before modification and@parentsmay contain 0 or more than 1 elements) intentional? What does it mean? It has all the readability of GOTO spaghetti…As an aside, you call a mutator potentially over and over, even though there seems to be no reason you couldn’t call it just once.
I think you meant something close to the following:
Or if the mutator call isn’t that expensive and has no other side effects you could just leave out the flag entirely.
Reply to This