in reply to array index -1 oddity

Perhaps it would help to consider a related situation.

I can almost see it making some sense to have $blah[-1]= $x; create a last element (a form of autovivification) and then set it. But if that were true than what should $blah[-2]= $y; do? Should it create a second-to-last element? So if @blah only contains one element, it would be the same as unshift @blah, $y; ? And if @blah is empty, it would be the same as @blah= ( $y, undef ); ?

Going to such extremes of autovivification stretches the imagination a bit more and is harder to justify/swallow. But I can't see drawing the line between -1 and -2 (or between any other particular pair of negative numbers) so either we'd always autovivify or never. Things get more bizarre when you consider all of the cases for $blah[-3]= $z;.

So, if you like, you could write up a patch that causes such assignments to unshift undef onto the array until the index makes sense. It kinda makes sense and even seems rather Perlish. I'm more looking for the option of having less autovivification than more, but some might like the idea. There's even a chance your patch might get accepted. I'm not sure how big of a chance...

        - tye