One solution is to get the index number of the last element and add one. We use $# for this:
# not very imaginative, but hopefully it helps
@array = qw(one two three four);
# get the number of elements
$number_of_elements = $#array +1;
print $number_of_elements;