"Perl for Perl Newbies" - Part 1ArraysThe foreach loopThe for keyword and the .. operator

9.3.1. The for keyword and the .. operator

The forkeyword in Perl means exactly the same as foreachand you can use either one interchangeably.

$x .. $yis a special operator that returns an array containing the sequence of consecutive integers from $xup to and including $y. Now one can fully understand the for $i (1 .. 10)construct that we used in the beginning of this lecture.

Written by Shlomi Fish