diff options
author | Lukas Mai <l.mai@web.de> | 2017-08-20 21:12:17 +0200 |
---|---|---|
committer | Lukas Mai <l.mai@web.de> | 2017-08-20 21:12:17 +0200 |
commit | e792e8c06267200185d8d7239eff4887535aa1ac (patch) | |
tree | 7e0fc2940f1895e1b8538d2ab7f2cfc2cfeb5326 /pod/perlop.pod | |
parent | f1f71a0091d3d691043f1da231e5b75df08737b6 (diff) | |
download | perl-e792e8c06267200185d8d7239eff4887535aa1ac.tar.gz |
perlop: fix documentation for s/// "false" return value
Commit a0d0e21ea6ea90a2231 ("perl-5.000") added perlop.pod, where s///
was described as returning 0 if no substitutions were made.
commit e37d713d85ec003d03d ("perl 5.003_01: pod/perlop.pod") then
"fixed" the documentation by saying it returns the empty string instead.
And that's how it's been since 1996.
What s/// actually returns on match failure is the canonical false
value, which is both "" and 0 at the same time (depending on
numeric/string context).
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index d7c52be36d..410085ffbc 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -2066,7 +2066,8 @@ X<regexp, substitute> X</m> X</s> X</i> X</x> X</p> X</o> X</g> X</c> X</e> X</r Searches a string for a pattern, and if found, replaces that pattern with the replacement text and returns the number of substitutions -made. Otherwise it returns false (specifically, the empty string). +made. Otherwise it returns false (a value that is both an empty string (C<"">) +and numeric zero (C<0>) as described in L</Relational Operators>). If the C</r> (non-destructive) option is used then it runs the substitution on a copy of the string and instead of returning the |