in reply to How do I completely remove an element from an array?
But then I got very concerned about the scope of things, particularly, when array is actually a reference to an array that has been passed into a subroutine and 'strict' is in use. I'm hoping that perl takes care of things, since we are indeed putting the temporary array created as part of the grep operation, back into the original array, which will stay in scope (and not be garbage collected when you leave a subroutine).@array = grep { $_ != $element_omitted } @array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How do I completely remove an element from an array?
by Minok (Novice) on Apr 23, 2009 at 00:05 UTC | |
by doug (Pilgrim) on Apr 23, 2009 at 17:25 UTC | |
by gone2015 (Deacon) on Apr 23, 2009 at 10:33 UTC | |
|
Re: Answer: How do I completely remove an element from an array?
by jdporter (Paladin) on Apr 23, 2009 at 17:37 UTC |