XP is just a number | |
PerlMonks |
Re: Question about ternary conditionby robartes (Priest) |
on Jun 28, 2005 at 09:45 UTC ( [id://470546]=note: print w/replies, xml ) | Need Help?? |
You're being bitten by precedence. Ternary ?: has a higher precedence than =, so what perl parses is:
You're effectively doing ($result='OK')='KO' in the case of a match, hence your output. The solution is of course to use parentheses:
Nice gotcha you found there :) CU
In Section
Seekers of Perl Wisdom
|
|