The stupid question is the question not asked | |
PerlMonks |
Re: Deleting specific element in array in FOREACH loopby hgolden (Pilgrim) |
on Sep 15, 2006 at 19:50 UTC ( [id://573236]=note: print w/replies, xml ) | Need Help?? |
Grep is god's gift to this situation. Check out grep. Basically, you can write a subroutine that takes the array element as an input and returns true or false, true if it should be included. Then you write a version of @newarray=grep {&subroutine($_)} @oldarray. The new array will only contain the elements that the subroutine returned true for. Hays
In Section
Seekers of Perl Wisdom
|
|