- or download this
my @array = qw/one two three four five/;
print scalar @array;
__OUTPUT__
5
- or download this
my @array = qw/one two three four five/;
print $#array;
__OUTPUT__
4
- or download this
my @array = qw/one two three four five/;
$array[2] = undef; # undefine one of the elements.
print scalar grep { defined $_ } @array;
__OUTPUT__
4
- or download this
my @array = qw/one two three four five/;
print $array[-1];
__OUTPUT__
five
- or download this
my @array = qw/one two three four five/;
$#array = 99;
print scalar @array;
__OUTPUT__
100