@array = grep { foo($_) } @array;
Update: If you want @array to contain only the items that return true, then this is fine. If you want to do some things if true and some other things if false, then stick with your original code.
In reply to Re: Removing Items from an Array
by Mr. Muskrat
in thread Removing Items from an Array
by ibanix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |