Don't ask to ask, just ask | |
PerlMonks |
Re: Confused by Perl ternary operatorby fruiture (Curate) |
on Aug 23, 2004 at 19:25 UTC ( [id://385190]=note: print w/replies, xml ) | Need Help?? |
Operator Precedence, again.
So, no matter what A evaluates to, E is being assigned, either to "B = C" (which is the same as assigning to B) or D. In your case B and D are identical, so your ?: operator doesn't do anything useful. Solution:
The last line demonstrates why the precedence of "?:" vs. "=" is actually sensible. HTH
-- http://fruiture.de
In Section
Seekers of Perl Wisdom
|
|