Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Compound statements within the conditional (ternary) operator

by mr_ron (Chaplain)
on Apr 14, 2018 at 13:02 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-29 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found