Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Compound statements within the conditional (ternary) operator

by mr_ron (Chaplain)
on Apr 14, 2018 at 13:02 UTC ( #1212871=note: print w/replies, xml ) Need Help??


in reply to Compound statements within the conditional (ternary) operator

Mostly what AnomalousMonk said. The first paragraph on ?: in Programming Perl (4th ed) talks about it being an operator and expression similar to if-then-else which is a flow control statement. A hopefully simpler example:

use Modern::Perl; my $count = 0; print defined $count ? do { my $s = ''; $s .= '=' until $count++ == 10; $s } : "Undefined count.\n";
Ron

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2022-12-07 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?