http://qs321.pair.com?node_id=107321


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:

print ($x ? $x.="hello" : $x.="Bye");
as
print ( ( $x ? $x.="hello" : $x ) .="Bye");
and not as
print ( $x ? $x.="hello" : ( $x.="Bye" ) );
The solution is, therefore, to use the last form to get it the way you want.

-----------------------------------------------------
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
    Ovid just asked similar Weird syntax question and htoug has elegant solution using wonderfull B::Deparse module.

    pmas
    To make errors is human. But to make million errors per second, you need a computer.