9.3.1. The for keyword and the .. operator
The for
keyword in Perl means exactly the same as foreach
and you can use either one interchangeably.
$x .. $y
is a special operator that returns an array containing the sequence of consecutive integers from $x
up to and including $y
. Now one can fully understand the for $i (1 .. 10)
construct that we used in the beginning of this lecture.