Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Question about ternary operator

by ikegami (Patriarch)
on Jul 01, 2009 at 18:31 UTC ( [id://776534]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Question about ternary operator
in thread Question about ternary operator

Thx, operator precedence is sometimes a PITA

If the precedence was reversed, the intended use would not work.

$y = $c ? $x1 : $x2;
would mean
($y = $c) ? $x1 : $x2;

By the way, it's called the "conditional operator". Perl has many ternary operators.

Replies are listed 'Best First'.
Re^4: Question about ternary operator
by Anonymous Monk on Jul 01, 2009 at 18:38 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://776534]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (9)
As of 2024-04-24 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found