diff options
author | Gisle Aas <gisle@aas.no> | 1998-06-24 22:26:48 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-06-28 19:44:19 +0000 |
commit | 89ea29081d863efc8d483f9cbe1c4e1dbb831359 (patch) | |
tree | c7e55c90b8da9656b7bb2b9467f183842bed6aae /pod | |
parent | 95a449b8d7e85665d931cb07abe3a369141c3170 (diff) | |
download | perl-89ea29081d863efc8d483f9cbe1c4e1dbb831359.tar.gz |
Optimize foreach (1..1000000)
Message-ID: <m3lnqmwt93.fsf@furu.g.aas.no>
p4raw-id: //depot/perl@1239
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldiag.pod | 7 | ||||
-rw-r--r-- | pod/perlop.pod | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index d6d261bb44..d8323f2328 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2047,6 +2047,13 @@ last argument of the previous construct, for example: (S) The subroutine being declared or defined had previously been declared or defined with a different function prototype. +=item Range iterator outside integer range + +(F) One (or both) of the numeric arguments to the range operator ".." +are outside the range which can be represented by integers internally. +One possible workaround is to force Perl to use magical string +increment by prepending "0" to your numbers. + =item Read on closed filehandle E<lt>%sE<gt> (W) The filehandle you're reading from got itself closed sometime before now. diff --git a/pod/perlop.pod b/pod/perlop.pod index 0a081b56d1..5232278362 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -369,10 +369,11 @@ Use "or" for assignment is unlikely to do what you want; see below. Binary ".." is the range operator, which is really two different operators depending on the context. In list context, it returns an array of values counting (by ones) from the left value to the right -value. This is useful for writing C<for (1..10)> loops and for doing -slice operations on arrays. Be aware that under the current implementation, -a temporary array is created, so you'll burn a lot of memory if you -write something like this: +value. This is useful for writing C<foreach (1..10)> loops and for +doing slice operations on arrays. In the current implementation, no +temporary array is created when the range operator is used as the +expression in C<foreach> loops, but older versions of Perl might burn +a lot of memory when you write something like this: for (1 .. 1_000_000) { # code |