From 9f4e46d9183600070b95e8ab0c7e56f87430f1a0 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 15 May 2025 08:55:59 -0600 Subject: [PATCH 01/16] perlop: Update advice on relational ops and Unicode Enhancements have been made in the last few releases to using these operators on UTF-8 locales; but this advice was not updated, so until this commit, said don't do that. --- pod/perlop.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index e31144e5361d..448a72220630 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -650,9 +650,9 @@ other and with respect to the equality operators of the same precedence. C<"lt">, C<"le">, C<"ge">, C<"gt"> and C<"cmp"> use the collation (sort) order specified by the current C locale if a S> form that includes collation is in effect. See L. -Do not mix these with Unicode, -only use them with legacy 8-bit locale encodings. -The standard C> and +Depending on the capabilities of the platform, these can give reasonable +results with Unicode, but +the standard C> and C> modules offer much more powerful solutions to collation issues. From 3668f21b340db519d2a6eeaecc23602e752b55c7 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 10:24:46 -0600 Subject: [PATCH 02/16] perlop: Move isa() section to proper place This document is supposed to be in decreasing operator precedence order. isa() is higher than the relational operators, so move it to there. --- pod/perlop.pod | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 448a72220630..ef28514dbb90 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -537,6 +537,25 @@ X<-X> X X See also L. +=head2 Class Instance Operator +X + +Binary C evaluates to true when the left argument is an object instance of +the class (or a subclass derived from that class) given by the right argument. +If the left argument is not defined, not a blessed object instance, nor does +not derive from the class given by the right argument, the operator evaluates +as false. The right argument may give the class either as a bareword or a +scalar expression that yields a string class name: + + if( $obj isa Some::Class ) { ... } + + if( $obj isa "Different::Class" ) { ... } + if( $obj isa $name_of_class ) { ... } + +This feature is available from Perl 5.31.6 onwards when enabled by +C. This feature is enabled automatically by a +C (or higher) declaration in the current scope. + =head2 Relational Operators X X @@ -661,25 +680,6 @@ function, available in Perl v5.16 or later: if ( fc($x) eq fc($y) ) { ... } -=head2 Class Instance Operator -X - -Binary C evaluates to true when the left argument is an object instance of -the class (or a subclass derived from that class) given by the right argument. -If the left argument is not defined, not a blessed object instance, nor does -not derive from the class given by the right argument, the operator evaluates -as false. The right argument may give the class either as a bareword or a -scalar expression that yields a string class name: - - if( $obj isa Some::Class ) { ... } - - if( $obj isa "Different::Class" ) { ... } - if( $obj isa $name_of_class ) { ... } - -This feature is available from Perl 5.31.6 onwards when enabled by -C. This feature is enabled automatically by a -C (or higher) declaration in the current scope. - =head2 Smartmatch Operator First available in Perl 5.10.1 (the 5.10.0 version behaved differently), From ef581932e4f5a1038b5c498c564f5f330d0a6662 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 10:27:37 -0600 Subject: [PATCH 03/16] perlop: Change 'if(' to 'if (' It is more customary to separate an 'if' from its paren. --- pod/perlop.pod | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index ef28514dbb90..e46eac024317 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -79,16 +79,16 @@ at all if the short-circuiting means that it's not required for any comparisons.) This matters if the computation of an interior argument is expensive or non-deterministic. For example, - if($x < expensive_sub() <= $z) { ... + if ($x < expensive_sub() <= $z) { ... is not entirely like - if($x < expensive_sub() && expensive_sub() <= $z) { ... + if ($x < expensive_sub() && expensive_sub() <= $z) { ... but instead closer to my $tmp = expensive_sub(); - if($x < $tmp && $tmp <= $z) { ... + if ($x < $tmp && $tmp <= $z) { ... in that the subroutine is only called once. However, it's not exactly like this latter code either, because the chained comparison doesn't @@ -547,10 +547,10 @@ not derive from the class given by the right argument, the operator evaluates as false. The right argument may give the class either as a bareword or a scalar expression that yields a string class name: - if( $obj isa Some::Class ) { ... } + if ( $obj isa Some::Class ) { ... } - if( $obj isa "Different::Class" ) { ... } - if( $obj isa $name_of_class ) { ... } + if ( $obj isa "Different::Class" ) { ... } + if ( $obj isa $name_of_class ) { ... } This feature is available from Perl 5.31.6 onwards when enabled by C. This feature is enabled automatically by a @@ -1583,7 +1583,7 @@ is the same as Note, however, that this does not always work for quoting Perl code: - $s = q{ if($x eq "}") ... }; # WRONG + $s = q{ if ($x eq "}") ... }; # WRONG is a syntax error. The C> module (standard as of v5.8, and from CPAN before then) is able to do this properly. From f4fd0fba4aa396845cd36cb6da198da39d5e0149 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 10:46:06 -0600 Subject: [PATCH 04/16] perlop: Fix grammatical nits --- pod/perlop.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index e46eac024317..271003a8bebc 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -223,7 +223,7 @@ as well as L. X X X<< -> >> "C<< -> >>" is an infix dereference operator, just as it is in C -and C++. If the right side is either a C<[...]>, C<{...}>, or a +and C++. If the right side is one of a C<[...]>, C<{...}>, or a C<(...)> subscript, then the left side must be either a hard or symbolic reference to an array, a hash, or a subroutine respectively. (Or technically speaking, a location capable of holding a hard @@ -482,7 +482,7 @@ in logical shift zero bits come in from the left. Either way, the implementation isn't going to generate results larger than the size of the integer type Perl was built with (32 bits or 64 bits). -Shifting by negative number of bits means the reverse shift: left +Shifting by a negative number of bits means the reverse shift: left shift becomes right shift, right shift becomes left shift. This is unlike in C, where negative shift is undefined. @@ -542,7 +542,7 @@ X Binary C evaluates to true when the left argument is an object instance of the class (or a subclass derived from that class) given by the right argument. -If the left argument is not defined, not a blessed object instance, nor does +If the left argument is not defined, not a blessed object instance, and does not derive from the class given by the right argument, the operator evaluates as false. The right argument may give the class either as a bareword or a scalar expression that yields a string class name: From b8b0c7cb9f871153cdd29e47ca2927a0eb733d7d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 10:51:19 -0600 Subject: [PATCH 05/16] perlop: Move trivial case to prominence Otherwise this dangling sentence gets lost after the main part of the section. --- pod/perlop.pod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 271003a8bebc..95b0c97f0624 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1493,6 +1493,8 @@ X X X X X +There is no low precedence operator for defined-OR. + Binary C<"or"> returns the logical disjunction of the two surrounding expressions. It's equivalent to C<||> except for the very low precedence. This makes it useful for control flow: @@ -1520,7 +1522,6 @@ Then again, you could always use parentheses. Binary C<"xor"> returns the exclusive-OR of the two surrounding expressions. It cannot short-circuit (of course). -There is no low precedence operator for defined-OR. =head2 C Operators Missing From Perl X X<&> X<*> From 2c4c5ac7eaef5549df264cdd45e6384b2492a9e2 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 10:56:23 -0600 Subject: [PATCH 06/16] Move discussion of relational ops into proper section These paragraphs were separated from the main area where all but one of their subjects, 'cmp', were discussed. Move them, and provide a link to the outlier, and back to the main discussion. --- pod/perlop.pod | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 95b0c97f0624..7fb305ab4434 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -604,6 +604,20 @@ the section L. Beware that they do not chain with equality operators, which have lower precedence. +C<"lt">, C<"le">, C<"ge">, C<"gt">, and C<"cmp"> (this last is described +in the L) use the collation (sort) +order specified by the current C locale if a S> form that includes collation is in effect. See L. +Depending on the capabilities of the platform, these can give reasonable +results with Unicode, but the standard C> and +C> modules offer much more powerful +solutions to collation issues. + +For case-insensitive comparisons, look at the L case-folding +function, available in Perl v5.16 or later: + + if ( fc($x) eq fc($y) ) { ... } + =head2 Equality Operators X X X X @@ -655,8 +669,10 @@ Here we can see the difference between <=> and cmp, print 10 <=> 2 #prints 1 print 10 cmp 2 #prints -1 -(likewise between gt and >, lt and <, etc.) X +(likewise between the relational operators that were described in the +L: gt and >, lt and +<, etc.) Binary C<"~~"> does a smartmatch between its arguments. Smart matching is described in the next section. @@ -666,20 +682,6 @@ The two-sided ordering operators C<"E=E"> and C<"cmp">, and the smartmatch operator C<"~~">, are non-associative with respect to each other and with respect to the equality operators of the same precedence. -C<"lt">, C<"le">, C<"ge">, C<"gt"> and C<"cmp"> use the collation (sort) -order specified by the current C locale if a S> form that includes collation is in effect. See L. -Depending on the capabilities of the platform, these can give reasonable -results with Unicode, but -the standard C> and -C> modules offer much more powerful -solutions to collation issues. - -For case-insensitive comparisons, look at the L case-folding -function, available in Perl v5.16 or later: - - if ( fc($x) eq fc($y) ) { ... } - =head2 Smartmatch Operator First available in Perl 5.10.1 (the 5.10.0 version behaved differently), From 0fde921c93d91aaf2b6b919d525e537e6834453d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:07:41 -0600 Subject: [PATCH 07/16] perlop: Add some C< >. --- pod/perlop.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 7fb305ab4434..ee6fa4c0906d 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -664,15 +664,15 @@ Binary C<"cmp"> returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument. -Here we can see the difference between <=> and cmp, +Here we can see the difference between C<< <=> >> and C, print 10 <=> 2 #prints 1 print 10 cmp 2 #prints -1 X (likewise between the relational operators that were described in the -L: gt and >, lt and -<, etc.) +L: C and C<< > >>, C and +C<< < >>, I.) Binary C<"~~"> does a smartmatch between its arguments. Smart matching is described in the next section. From dd1f55c6286e7ee679e925de39ed83cc283b6885 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:09:52 -0600 Subject: [PATCH 08/16] perlop: Fix up smartmatch section This has the same precedence as other operators, so should not be in a separate section with the same heading level. Solve this by making it at a sublevel. This fits nicely with another sublevel section on smartmatch that follows immediately. There are now to subsections. --- pod/perlop.pod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index ee6fa4c0906d..0a0ed3a54076 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -675,14 +675,15 @@ L: C and C<< > >>, C and C<< < >>, I.) Binary C<"~~"> does a smartmatch between its arguments. Smart matching -is described in the next section. +is complicated enough to warrant +L, starting just below. X<~~> The two-sided ordering operators C<"E=E"> and C<"cmp">, and the smartmatch operator C<"~~">, are non-associative with respect to each other and with respect to the equality operators of the same precedence. -=head2 Smartmatch Operator +=head3 Smartmatch Operator First available in Perl 5.10.1 (the 5.10.0 version behaved differently), binary C<~~> does a "smartmatch" between its arguments. This is mostly From 8a31c0afdfdf97416d77a4ad097973ef47f3c042 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:14:31 -0600 Subject: [PATCH 09/16] perlop: Fix up a couple X<> This gets things more rationally ordered --- pod/perlop.pod | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 0a0ed3a54076..edf9582f00b9 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1492,9 +1492,8 @@ precedence. This means that it short-circuits: the right expression is evaluated only if the left expression is true. =head2 Logical or and Exclusive Or -X X -X -X X +X X +X X X There is no low precedence operator for defined-OR. From 78335c4c47352ff6643d1d363401faea0ae432b1 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:17:40 -0600 Subject: [PATCH 10/16] perlop: Use formal terminology to distinguish or, xor --- pod/perlop.pod | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index edf9582f00b9..0c54f948103a 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1497,9 +1497,9 @@ X X X There is no low precedence operator for defined-OR. -Binary C<"or"> returns the logical disjunction of the two surrounding -expressions. It's equivalent to C<||> except for the very low precedence. -This makes it useful for control flow: +Binary C<"or"> returns the logical inclusive disjunction of the two +surrounding expressions. It's equivalent to C<||> except for it having +very low precedence. This makes it useful for control flow: print FH $data or die "Can't write to FH: $!"; @@ -1521,7 +1521,8 @@ takes higher precedence. Then again, you could always use parentheses. -Binary C<"xor"> returns the exclusive-OR of the two surrounding expressions. +Binary C<"xor"> returns the logical exclusive disjunction of the two +surrounding expressions. It cannot short-circuit (of course). From 943490c89ce7f769aeddec2ca3fcae572a73ff72 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:20:16 -0600 Subject: [PATCH 11/16] perlop: Add detail about xor Fixes #18565 --- pod/perlop.pod | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 0c54f948103a..5e051150bb92 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1522,9 +1522,15 @@ takes higher precedence. Then again, you could always use parentheses. Binary C<"xor"> returns the logical exclusive disjunction of the two -surrounding expressions. -It cannot short-circuit (of course). - +surrounding expressions. That means it returns C if either, but +not both, are true. It's equivalent to C<^^> except for it having very +low precedence. It cannot short-circuit (of course). It tends to be +used to verify that two mutually-exclusive conditions are actually +mutually exclusive. For example, in Perl's test suite, we might want to +test that a regular expression pattern can't both match and not match, +for otherwise it would be a bug in our pattern matching code. + + ($x =~ qr/$pat/ xor $x !~ qr/$pat/) or die; =head2 C Operators Missing From Perl X X<&> X<*> From da1efd5359a1be0c4ee38064596eb29459d59029 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:33:48 -0600 Subject: [PATCH 12/16] perlop: Move discussion into proper sections This detail for two sections was combined in a whole other section. This splits the detail into text appropriate for each section to which it applies, and moves it there. --- pod/perlop.pod | 52 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 5e051150bb92..4420b320d498 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1017,6 +1017,12 @@ if the left operand is false, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it is evaluated. +As an alternative to C<&&> when used for control flow, Perl provides the +C operator (see L). +The short-circuit behavior is identical. The precedence of C<"and"> is +much lower, however, so that you can safely use it after a list operator +without the need for parentheses. + =head2 C-style Logical Or X<||> X @@ -1025,6 +1031,29 @@ if the left operand is true, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it is evaluated. +As an alternative to C<||> when used for control flow, Perl provides the +C operator (L). +The short-circuit behavior is identical. The precedence of C<"or"> is +much lower, however, so that you can safely use it after a list operator +without the need for parentheses: + + unlink "alpha", "beta", "gamma" + or gripe(), next LINE; + +With the C-style operator that would have been written like this: + + unlink("alpha", "beta", "gamma") + || (gripe(), next LINE); + +It would be even more readable to write that this way: + + unless(unlink("alpha", "beta", "gamma")) { + gripe(); + next LINE; + } + +Using C<"or"> for assignment is unlikely to do what you want; see below. + =head2 C-style Logical Xor X<^^> X @@ -1064,29 +1093,6 @@ for selecting between two aggregates for assignment: @a = scalar(@b) || @c; # because it really means this. @a = @b ? @b : @c; # This works fine, though. -As alternatives to C<&&> and C<||> when used for -control flow, Perl provides the C and C operators (see below). -The short-circuit behavior is identical. The precedence of C<"and"> -and C<"or"> is much lower, however, so that you can safely use them after a -list operator without the need for parentheses: - - unlink "alpha", "beta", "gamma" - or gripe(), next LINE; - -With the C-style operators that would have been written like this: - - unlink("alpha", "beta", "gamma") - || (gripe(), next LINE); - -It would be even more readable to write that this way: - - unless(unlink("alpha", "beta", "gamma")) { - gripe(); - next LINE; - } - -Using C<"or"> for assignment is unlikely to do what you want; see below. - =head2 Range Operators X X X<..> X<...> From e90d99a4521837af9c7f0220f7962ba7729d7c5e Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:47:20 -0600 Subject: [PATCH 13/16] perlop: Combine equal precedence ops into same section The design of this pod is each section is for all operators of the same precedence. This was being violated --- pod/perlop.pod | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 4420b320d498..da8cbbfe6991 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1017,14 +1017,19 @@ if the left operand is false, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it is evaluated. +C<&&> returns the last value evaluated (unlike C's C<&&>, which returns +0 or 1). + As an alternative to C<&&> when used for control flow, Perl provides the C operator (see L). The short-circuit behavior is identical. The precedence of C<"and"> is much lower, however, so that you can safely use it after a list operator without the need for parentheses. -=head2 C-style Logical Or +=head2 C-style Logical Or, Xor, and Defined Or X<||> X +X<^^> X +X X Binary C<"||"> performs a short-circuit logical OR operation. That is, if the left operand is true, the right operand is not even evaluated. @@ -1054,16 +1059,10 @@ It would be even more readable to write that this way: Using C<"or"> for assignment is unlikely to do what you want; see below. -=head2 C-style Logical Xor -X<^^> X - Binary C<"^^"> performs a logical XOR operation. Both operands are evaluated and the result is true only if exactly one of the operands is true. Scalar or list context propagates down to the right operand. -=head2 Logical Defined-Or -X X - Although it has no direct equivalent in C, Perl's C operator is related to its C-style "or". In fact, it's exactly the same as C<||>, except that it tests the left hand side's definedness instead of its truth. Thus, @@ -1077,8 +1076,8 @@ cannot). This is very useful for providing default values for variables. If you actually want to test if at least one of C<$x> and C<$y> is defined, use S>. -The C<||>, C and C<&&> operators return the last value evaluated -(unlike C's C<||> and C<&&>, which return 0 or 1). Thus, a reasonably +The C<||>, C<^^> and C operators return the last value evaluated +(unlike C's C<||> which returns 0 or 1). Thus, a reasonably portable way to find out the home directory might be: $home = $ENV{HOME} @@ -3852,6 +3851,24 @@ Here is a short, but incomplete summary: Choose wisely. +=head2 C-style Logical Or + +This section has been superceded by +L. The heading is retained +only to prevent breaking any pre-existing links to it from outside. + +=head2 C-style Logical Xor + +This section has been superceded by +L. The heading is retained +only to prevent breaking any pre-existing links to it from outside. + +=head2 Logical Defined-Or + +This section has been superceded by +L. The heading is retained +only to prevent breaking any pre-existing links to it from outside. + =head1 APPENDIX =head2 List of Extra Paired Delimiters From f4271db6075001b156071252bda5c5acc33524c6 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:51:17 -0600 Subject: [PATCH 14/16] perlop: Specifically give an operations' results --- pod/perlop.pod | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index da8cbbfe6991..87600e347b43 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -990,9 +990,13 @@ C<"experimental::bitwise"> category. X X X<|> X X X<^> -Binary C<"|"> returns its operands ORed together bit by bit. +Binary C<"|"> returns its operands ORed together bit by bit. If both +corresponding bits are 0, the resulting bit is 0; if either is 1, the result is +1. -Binary C<"^"> returns its operands XORed together bit by bit. +Binary C<"^"> returns its operands XORed together bit by bit. If both +corresponding bits are 0 or both are 1, the resulting bit is 0; if just +one is 1, the result is 1. Although no warning is currently raised, the results are not well defined when these operations are performed on operands that aren't either From d6d977018778ba65fd5148753b6dec14e2108a0d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:52:10 -0600 Subject: [PATCH 15/16] perlop: A few clarifications --- pod/perlop.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 87600e347b43..d640395d1893 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -18,7 +18,7 @@ means that Perl has two versions of some operators, one for numeric and one for string comparison. For example S> compares two numbers for equality, and S> compares two strings. -There are a few exceptions though: C can be either string +There are a few exceptions though: The operator C can be either string repetition or list repetition, depending on the type of the left operand, and C<&>, C<|>, C<^> and C<~> can be either string or numeric bit operations. @@ -216,7 +216,7 @@ Also parsed as terms are the S> and S> constructs, as well as subroutine and method calls, and the anonymous constructors C<[]> and C<{}>. -See also L toward the end of this section, +See also L below, as well as L. =head2 The Arrow Operator @@ -1038,7 +1038,7 @@ X X Binary C<"||"> performs a short-circuit logical OR operation. That is, if the left operand is true, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it -is evaluated. +does get evaluated. As an alternative to C<||> when used for control flow, Perl provides the C operator (L). From 0f67ca43e9d1c5b9e181044c4e55ffe789c40a3b Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 17 May 2025 11:53:06 -0600 Subject: [PATCH 16/16] perlop: Specifically mention this document's structure --- pod/perlop.pod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index d640395d1893..1d07870ebbb8 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -152,8 +152,9 @@ values only, not array values. left and left or xor -In the following sections, these operators are covered in detail, in the -same order in which they appear in the table above. +The following sections cover these operators in detail. Each section +covers all the operators for a single precedence level. The sections +are ordered highest precedence first, same as in the table above. Many operators can be overloaded for objects. See L.