If you want to remove the elements from the array entirely, grep is the way:
That eliminates fencepost errors and leaves no empty slots in the array. Your code should work, but it does not remove the array slot.@array = grep { $_ ne $item } @array;
Updade: Corrected pasteo.
After Compline,
Zaxo
In reply to Re: Deleting elements from array questions
by Zaxo
in thread Deleting elements from array questions
by chuleto1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |