Yes, if $p were being assigned the return value of the flip-flop operator, as in the OP, then it would indeed be incremented by one on each iteration in which the flip-flop operator evaluates to true. But by using parentheses in:
if(($p=3)..5)
you ensure that 3 is assigned to $p before the flip-flop operator is evaluated. Then the value of $p (now 3) is used in the evaluation of the flip-flop operator; and since 3 is “true” in Perl, the operator returns a sequence number (which is also true). That sequence number is not assigned to any variable, it’s just used to determine the outcome of the if statement.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^5: flip flop operator and if statement
by Athanasius
in thread flip flop operator and if statement
by iThunder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |