Range operator
The ..
range
operator is really two different operators depending on the
context. In a list context, it returns a list of values counting
(by ones) from the left value to the right value.
In a scalar context, ..
returns a Boolean value. It is false as long as its left operand
is false. Once the left operand is true, the range operator stays
true until the right operand is true, after which the range
operator becomes false again. The right operand is not evaluated
while the operator is in the false state, and the left operand is
not evaluated while the operator is in the true state.
The alternate version of this operator, ...
, does not test the right operand
immediately when the operator becomes true; it waits until the
next evaluation.
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.