summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-05-11 16:58:22 +0000
committerAbhijit Menon-Sen <ams@wiw.org>2005-05-11 16:57:27 +0000
commit52ea55c9ee04ef3b03dd13373eda27b47fea1087 (patch)
tree1895a659aa695f9993ea33ea273ac484715672a3 /pod
parente800eb2ef64b60f7fef69c20beaa3589a131c1c8 (diff)
downloadperl-52ea55c9ee04ef3b03dd13373eda27b47fea1087.tar.gz
[perl #33765] [PATCH] perlop: mention why 'print !!0' doesn't
From: Steve Peters via RT <perlbug-followup@perl.org> Date: 11 May 2005 16:58:22 -0000 Message-Id: <rt-3.0.11-33765-112475.14.5633321030279@perl.org> Subject: [perl #33766] [PATCH] perldoc -f split lacks basic null example From: Steve Peters via RT <perlbug-followup@perl.org> Date: 11 May 2005 17:13:29 -0000 Message-Id: <rt-3.0.11-33766-112476.1.84217630998887@perl.org> p4raw-id: //depot/perl@24449
Diffstat (limited to 'pod')
-rw-r--r--pod/perlfunc.pod16
-rw-r--r--pod/perlsyn.pod3
2 files changed, 14 insertions, 5 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 81a42c2ab3..d7b9bfa683 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -5079,12 +5079,18 @@ produces the output 'h:i:t:h:e:r:e'.
Using the empty pattern C<//> specifically matches the null string, and is
not be confused with the use of C<//> to mean "the last successful pattern
-match".
+match". So, for C<split>, the following are equivalent:
-Empty leading (or trailing) fields are produced when there are positive width
-matches at the beginning (or end) of the string; a zero-width match at the
-beginning (or end) of the string does not produce an empty field. For
-example:
+ print join(':', split(//, 'hi there'));
+
+ print join(':', split('', 'hi there'));
+
+and they produce the output 'h:i: :t:h:e:r:e'.
+
+Empty leading (or trailing) fields are produced when there are positive
+width matches at the beginning (or end) of the string; a zero-width match
+at the beginning (or end) of the string does not produce an empty field.
+For example:
print join(':', split(/(?=\w)/, 'hi there!'));
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index aabd65d212..3d45d55f52 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -105,6 +105,9 @@ as the last item in a statement.
The number 0, the strings C<'0'> and C<''>, the empty list C<()>, and
C<undef> are all false in a boolean context. All other values are true.
+Negation of a true value by C<!> or C<not> returns a special false value.
+When evaluated as a string it is treated as C<''>, but as a number, it
+is treated as 0.
=head2 Statement Modifiers