in reply to Evaluating the condition ($x)

So, short answer: use more brackets. I sprinkle a fair number of brackets in my code, and I'm also generous with white space. It helps clarify the meaning of the code, and hopefully avoids situations like this.

Longer answer: For your first example, I would write that as

if ( $x ) { print "true\n"; } else { print "false\n"; }
rather than use a bare ternary as you have done. A ternary is more useful if you're in the middle of a print statement, like this:
print "The truth value of x is " . ( $x ? 'true' : 'false' ) . "\n";
The ternary operator comes from C -- it's a great piece of shorthand.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.