in reply to ?: (conditional operator)
Based on perlop , the terany operator (?:) is just one precidence level above the "operate and set" operators .=, +=, etc.
Thus, perl is seeing:
asprint ($x ? $x.="hello" : $x.="Bye");
and not asprint ( ( $x ? $x.="hello" : $x ) .="Bye");
The solution is, therefore, to use the last form to get it the way you want.print ( $x ? $x.="hello" : ( $x.="Bye" ) );
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
It's not what you know, but knowing how to find it if you don't know that's important
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: ?: (conditional operator)
by pmas (Hermit) on Aug 23, 2001 at 18:56 UTC |
In Section
Seekers of Perl Wisdom