On Fri, Sep 11, 2009 at 14:54, Chas. Owens <chas.ow...@gmail.com> wrote: snip >> In case it isn't clear enough, my question (not directly to you, but >> to the perl maintainers) is "Where does perl document the ternary >> operator's behaviour of only evaluating either the second or the third >> argument, never both?" I have looked in perldoc perlop. If you have a >> better place for me to look, by all means let me know. But if it's not >> in perlop, why isn't it? > snip > > It is fully documented in the source code of Perl; as many things are. > It is not documented the way you want in perlop because most people > understand the way it is currently documented there. snip
Apparently it is also documented, to the level of detail I think you require, in the 3rd edition of the Camel: As in C, ?: is the only trinary operator. It's often called the conditional operator because it works much like an if-then-else, except that, since it's an expression and not a statement, it can be safely embedded within other expressions and functions calls. As a trinary operator, its two parts separate three expressions: COND ? THEN : ELSE If the condition COND is true, only the THEN expression is evaluated, and the value of that expression becomes the value of the entire expression. Otherwise, oly the ELSE expression is evaluated, and its value becomes the value of the entire expression. Scalar or list context propagates downward into the second or third argument, whichever is selected. (The first argument is always in scalar context, since it is a conditional.) More follows, but you get the idea. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/