Using negative subscripts to access elements from the end of the array : Array Index « Array « Perl
- Perl
- Array
- Array Index
Using negative subscripts to access elements from the end of the array
@array = qw( zero one two three four five six seven eight nine );
print "\@array[ -1 ] is $array[ -1 ].\n";
print "\@array[ -4 ] is $array[ -4 ].\n\n";
Related examples in the same category