Problems? Is your data what you think it is? | |
PerlMonks |
Re: Perl ternary operator styleby TomDLux (Vicar) |
on May 30, 2011 at 15:35 UTC ( [id://907331]=note: print w/replies, xml ) | Need Help?? |
I agree with BrowserUK and others about appropriate use of || or //. More generally, I would say ternary operator is great when you have simple values to compare. If the terms become complicated, you want something else, maybe an actual IF block. It's not just a matter of making the code work correctly. The code needs to be decipherable for the sucker who has to read it six months from now to implement some change requirement. As Occam said: Entia non sunt multiplicanda praeter necessitatem.
In Section
Seekers of Perl Wisdom
|
|