in reply to deleting array elements(efficiency/critique)

Instead of deleting or undefing elements you could use splice.
# delete $array[$x]; # $array[$x] = undef; splice @array, $x, 1;
That way you don't have to go through a garbage collection stage later, but you may not gain much in speed since splice is slower that delete.