$array[-1]
instead
of $array[$#array]
. The former works on both lists and arrays,
but the latter does not.substr
, index
, rindex
, and splice
also accept negative subscripts to count back from the end.split(@array, -2); # pop twice
substr($s, -10) =~ s/ /./g;
Forward to Embrace Hashes
Back to Changing en passant
Up to index
Copyright © 1998, Tom Christiansen
All rights reserved.