On Mar 29, 2010, at 10:54 AM, r...@i.frys.com wrote:

I looked through perlop and was unable to find where it
stated that the ternary operator should only be used in an
assignment such as you've shown.  Can you point out where
that's located.


In my reasonably-arrogant opinion: That's kind of embedded in the DEFINITION of the word "operator"



I often use the ternary operator when working with
dispatch tables.  Based on your comment, I suspect that
you feel that the following example is a poor use of the
ternary operator.  Please correct me if I'm wrong.

exists $dispatch{$status} ? $dispatch{$status}->()
                         : $dispatch{'error'}->();


I would definitely avoid that construction and find a better idiom ... but you don't work for me, so you can feel free to ignore my advice.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to