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 @@ -1522,9 +1522,15 @@ takes higher precedence.
1522
1522
Then again, you could always use parentheses.
1523
1523
1524
1524
Binary C<"xor"> returns the logical exclusive disjunction of the two
1525
- surrounding expressions.
1526
- It cannot short-circuit (of course).
1527
-
1525
+ surrounding expressions. That means it returns C<true> if either, but
1526
+ not both, are true. It's equivalent to C<^^> except for it having very
1527
+ low precedence. It cannot short-circuit (of course). It tends to be
1528
+ used to verify that two mutually-exclusive conditions are actually
1529
+ mutually exclusive. For example, in Perl's test suite, we might want to
1530
+ test that a regular expression pattern can't both match and not match,
1531
+ for otherwise it would be a bug in our pattern matching code.
1532
+
1533
+ ($x =~ qr/$pat/ xor $x !~ qr/$pat/) or die;
1528
1534
1529
1535
=head2 C Operators Missing From Perl
1530
1536
X<operator, missing from perl> X<&> X<*>
You can’t perform that action at this time.
0 commit comments