in reply to Ceiling elements of an array!
Maybe I'm missing something here, but it seems these answers are unnecessarily complicated.
If you want to know how many elements are in an array, Perl gives that to you:
my $elementCount = @myArray;
The first three elements are [0], [1], and [2].
The last three are [-1], [-2], and [-3](counted from the end, so, backwards):
for (my $currentElementNumber = 0; $currentElementNumber < 3; $cur +rentElementNumber++) { my $currentElementValue = $myArray[$currentElementNumber]; # Do stuff here }
|
|---|