Keep It Simple, Stupid | |
PerlMonks |
Re^3: What array negative number counting meansby LanX (Saint) |
on Jul 28, 2020 at 00:16 UTC ( [id://11119870]=note: print w/replies, xml ) | Need Help?? |
(scalar @x) is the length of @x here 3 (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
In Section
Seekers of Perl Wisdom
|
|