in reply to Re: $[ is under respected.
in thread $[ is under respected.
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:
So I may write: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; } }
{ local $[ = 1; for my $x (1 .. $X) { for my $y (1 .. $Y) { # Do something with $array[$x][$y] print "bla, bla ($x, $y)"; } } }
|
|---|