summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke D <haukex@zero-g.net>2020-02-10 20:24:35 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2020-12-26 15:29:34 +0000
commitf53b87f8ed3048945d7c727cffcfb0f925c789e5 (patch)
treeeda8bddb39f8bacff61993b0ad3f8d369da50377
parente87116a35673b40c0a216d14a4aa71394b4a3791 (diff)
downloadperl-f53b87f8ed3048945d7c727cffcfb0f925c789e5.tar.gz
Note range op behavior change in docs
This change documents the previous behavior of the range operator with magic string increment in Perl 5.30 and below - the change was introduced in commit d1bc97feec from GitHub #16770 (RT133695). (cherry picked from commit f4941eebb5185b70b980fcfea9f7b02f377f1f70)
-rw-r--r--pod/perlop.pod8
1 files changed, 8 insertions, 0 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 2f0fa4abf7..3e6c10f767 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1214,6 +1214,14 @@ If you want to force strings to be interpreted as numbers, you could say
@numbers = ( 0+$first .. 0+$last );
+B<Note:> In Perl versions 5.30 and below, I<any> string on the left-hand
+side beginning with C<"0">, including the string C<"0"> itself, would
+cause the magic string increment behavior. This means that on these Perl
+versions, C<"0".."-1"> would produce C<"0"> through C<"99">, which was
+inconsistent with C<0..-1>, which produces the empty list. This also means
+that C<"0".."9"> now produces a list of integers instead of a list of
+strings.
+
=item *
If the initial value specified isn't part of a magical increment