in reply to Accessing array elements
Isn't $i initialized with 0 inside the for loop?
it is... but if you test $i < @array and then access elements with an index $i*2, you're accessing elements outside of those you have defined...