#splice is still O(n) $array[$index] = $array[-1]; pop @array;