in reply to Re: $[ is under respected.
in thread $[ is under respected.

Actually, your "far fetched" idea is close to the reason why Perl has $[. It's not so for porting non-Perl code to Perl, but for porting non-Perl programmers to Perl. In its early days, Perl didn't have many users, and it needed to recruit programmers who were familiar with other languages. Fortran for instance, but more likely, awk.

I sometimes use $[. Whenever I find myself using -1 and +1 to switch to and from computer and human counting, I consider telling the computer to adapt to humans, and use $[. So instead of:

for my $x (0 .. $X - 1) { for my $y (0 .. $Y - 1) { # Do something with $array[$x][$y] printf "bla, bla (%d, %d)", $x + 1, $y + 1; } }
So I may write:
{ local $[ = 1; for my $x (1 .. $X) { for my $y (1 .. $Y) { # Do something with $array[$x][$y] print "bla, bla ($x, $y)"; } } }