File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1530,9 +1530,15 @@ takes higher precedence.
1530
1530
Then again, you could always use parentheses.
1531
1531
1532
1532
Binary C<"xor"> returns the logical exclusive disjunction of the two
1533
- surrounding expressions.
1534
- It cannot short-circuit (of course).
1535
-
1533
+ surrounding expressions. That means it returns C<true> if either, but
1534
+ not both, are true. It's equivalent to C<^^> except for it having very
1535
+ low precedence. It cannot short-circuit (of course). It tends to be
1536
+ used to verify that two mutually-exclusive conditions are actually
1537
+ mutually exclusive. For example, in Perl's test suite, we might want to
1538
+ test that a regular expression pattern can't both match and not match,
1539
+ for otherwise it would be a bug in our pattern matching code.
1540
+
1541
+ ($x =~ qr/$pat/ xor $x !~ qr/$pat/) or die;
1536
1542
1537
1543
=head2 C Operators Missing From Perl
1538
1544
X<operator, missing from perl> X<&> X<*>
You can’t perform that action at this time.
0 commit comments