Mega Code Archive

 
Categories / Perl / Array
 

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";