http://qs1969.pair.com?node_id=11127970

rsFalse has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
I got a warning message "Found = in conditional, should be" after executing that code:
perl -wle 'my $has_even; @_ = -1 .. 9; for( @_ ){ print $_; $_ % 2 or +$has_even = 1 and last } print "\$has_even:[$has_even]"; '
OUTPUT:
Found = in conditional, should be == at -e line 1. -1 0 $has_even:[1]
Here '=' is intentional, so a warning is obsolete.
I think it is useful warning message to catch mistype. But in perlop operators 'and' and 'or' are not named being conditional. It is explained in other words (e.g. for 'and'): "the right expression is evaluated only if the left expression is true". In perlop document there is a section named "Conditional Operator", which is about ternary conditional operator. But it seems that it is not the only one conditional operator. So for clarity this section could be renamed to "ternary conditional operator". And also it could be added "a conditional operator" within description of 'and' and 'or'. Also a conditioness attribute could be shown in a widened attribute table (idea proposed in earlier node: For discussion: operator attributes - associativity, chainity and ability to short-circuit).

Back to a warning message. In my code instead of "$has_even = 1" it could be '$has_even = "TRUE"'. In that case a warning would seem even more obsolete because "TRUE" is not number-like.