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


in reply to Situation where warning "Found = in conditional, should be" seems obsolete

For complete picture I want to share findings that this warning does appear if (1) right side of an assignment '=' operator contains a "constant" (i.e. number, string), except 'undef'; And the warning does not appear if (2) the left side of an assignment operator '=' is enclosed with parentheses or if it is an array. I think it is desired behavior. Of course if some coder have wanted to compare his array with a number (e.g. @_ == 5, i.e. if a number of elements of an array equals to 5) and he accidentally put one '=' instead of '==', warning won't appear; And example:
perl -wle '@_ = -1 .. 3; for( @_ ){ print $_; ( ) = 0 or last }'
OUTPUT:
-1 0 1 2 3
No warning.
Note that 'last' never executed because of: an assignment operator works as "list assignment operator" (because of parentheses on the left side of the '='), and an operator 'or' asked for scalar context. In scalar context list assignment operator returns a number of elements of the right side (i.e. one element: '0').