Skip to content

Commit aaee595

Browse files
committed
Remove caveat about temporary arrays in for range loops
The optimisation to not create the array was introduced in Perl 5.005 (commit 89ea290), there's no need to have a caveat about versions older than that any more.
1 parent 80f266d commit aaee595

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

pod/perlop.pod

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -806,15 +806,9 @@ operators depending on the context. In list context, it returns a
806806
list of values counting (up by ones) from the left value to the right
807807
value. If the left value is greater than the right value then it
808808
returns the empty list. The range operator is useful for writing
809-
S<C<foreach (1..10)>> loops and for doing slice operations on arrays. In
810-
the current implementation, no temporary array is created when the
811-
range operator is used as the expression in C<foreach> loops, but older
812-
versions of Perl might burn a lot of memory when you write something
813-
like this:
814-
815-
for (1 .. 1_000_000) {
816-
# code
817-
}
809+
S<C<foreach (1..10)>> loops and for doing slice operations on arrays.
810+
No temporary array is created when the range operator is used as the
811+
expression in C<foreach> loops.
818812

819813
The range operator also works on strings, using the magical
820814
auto-increment, see below.

0 commit comments

Comments
 (0)