- or download this
$[++; # No go.
$[+=1; # Not happening
$[ = $[; # Works.
...
print \$[; # Ok, works.
$[ = \$[; # which also works
print $[; # Whoo fun!
- or download this
$[=-1;
@_=qw/foo bar baz/;
print $_[-1]; # foo
print $_[-2]; # bar
print $_[-3]; # foo
- or download this
#WRONG:
for(my $i=0; $i<$#foo; $i++){}
#RIGHT:
for(my $i=$[; $i<$#foo; $i++){}
- or download this
#WRONG:
foreach(0..$#foo){}
#RIGHT:
foreach($[..$#foo){}