The for keyword and the .. operator

Contents | Up | Prev | Next

# 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.

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

Contents | Up | Prev | Next