programming-examples/perl/Array/The Array Size Indicator.pl

15 lines
464 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$[ = 9999; #This loop doesn't run because @checksThisMonth returns the array size, which is less than 1501.
for ($i = $[; #initialization list
$i < @checksThisMonth; #conditional expression
$i++){ #increment list
print "$checksThisMonth[$i]";
}
#This loop runs because $#checksThisMonth returns the last cell index.
for ($i = $[; $i <= $#checksThisMonth; $i++){
print "$checksThisMonth[$i]";
}