in reply to Deleting internal array elements

Performance-wise, you may be better off keeping the element in the array, and simply assigning undef to it.

You will need a scalar counter to keep track of the number of valid elements, and if that hits zero, you are done.