@@ -987,9 +987,13 @@ C<"experimental::bitwise"> category.
987987X<operator, bitwise, or> X<bitwise or> X<|> X<operator, bitwise, xor>
988988X<bitwise xor> X<^>
989989
990- Binary C<"|"> returns its operands ORed together bit by bit.
990+ Binary C<"|"> returns its operands ORed together bit by bit. If both
991+ corresponding bits are 0, the resulting bit is 0; if either is 1, the result is
992+ 1.
991993
992- Binary C<"^"> returns its operands XORed together bit by bit.
994+ Binary C<"^"> returns its operands XORed together bit by bit. If both
995+ corresponding bits are 0 or both are 1, the resulting bit is 0; if just
996+ one is 1, the result is 1.
993997
994998Although no warning is currently raised, the results are not well
995999defined when these operations are performed on operands that aren't either
@@ -1488,14 +1492,12 @@ expressions. It's equivalent to C<&&> except for the very low
14881492precedence. This means that it short-circuits: the right
14891493expression is evaluated only if the left expression is true.
14901494
1491- =head2 Logical or and Exclusive Or
1492- X<operator, logical, or> X<operator, logical, xor>
1493- X<operator, logical, exclusive or>
1494- X<or> X<xor>
1495+ =head2 Logical Or
1496+ X<operator, logical, or> X<or>
14951497
1496- Binary C<"or"> returns the logical disjunction of the two surrounding
1497- expressions. It's equivalent to C<||> except for the very low precedence.
1498- This makes it useful for control flow:
1498+ Logical C<"or"> returns the logical inclusive disjunction of the two
1499+ surrounding expressions. It's equivalent to C<||> except for it having
1500+ very low precedence. This makes it useful for control flow:
14991501
15001502 print FH $data or die "Can't write to FH: $!";
15011503
@@ -1517,11 +1519,22 @@ takes higher precedence.
15171519
15181520Then again, you could always use parentheses.
15191521
1520- Binary C<"xor"> returns the exclusive-OR of the two surrounding expressions.
1521- It cannot short-circuit (of course).
1522-
15231522There is no low precedence operator for defined-OR.
15241523
1524+ =head2 Logical Exclusive Or
1525+ X<operator, logical, xor> X<operator, logical, exclusive or> X<xor>
1526+
1527+ Logical C<"xor"> returns the logical exclusive disjunction of the two
1528+ surrounding expressions. That means it returns C<true> if either, but
1529+ not both, are true. It's equivalent to C<^^> except for it having very
1530+ low precedence. It tends to be used to verify that two
1531+ mutually-exclusive conditions are actually mutually exclusive. For
1532+ example, in Perl's test suite, we might want to test that a regular
1533+ expression pattern can't both match and not match, for otherwise it
1534+ would be a bug in our pattern matching code.
1535+
1536+ ($a =~ qr/$pat/ xor $a !~ qr/$pat/) or die;
1537+
15251538=head2 C Operators Missing From Perl
15261539X<operator, missing from perl> X<&> X<*>
15271540X<typecasting> X<(TYPE)>
@@ -3836,6 +3849,11 @@ Here is a short, but incomplete summary:
38363849
38373850Choose wisely.
38383851
3852+ =head2 Logical or and Exclusive Or
3853+
3854+ This section has been split into L</Logical Or> and
3855+ L</Logical Exclusive Or>.
3856+
38393857=head1 APPENDIX
38403858
38413859=head2 List of Extra Paired Delimiters
0 commit comments