Hm, strange.. I actually wrote
$foo[$[] in the assuption this would prevent any
$[-fiddling and force the real solution, but it seems
$[ really doesn't work properly in perl:
perl -le '$[ = -1; @x = (42); $y = 0; print $x[$y]' prints 42 for me on 5.8.3 and 5.8.4...
I'll add a note to the exercise that the intention is to solve it without diddling $[