(scalar @x) - 1 == 2
In other words
$x[-y] is a shortcut for $x[(scalar @x) - y]
=>
$x[-1] eq $x[2] eq "light"
$x[-2] eq $x[1] eq "bar"
$x[-3] eq $x[0] eq "foo"
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: What array negative number counting means
by LanX
in thread What array negative number counting means
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |