Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: conditional statements in list constructors

by kcott (Bishop)
on Mar 27, 2014 at 14:48 UTC ( #1079937=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print 1<2 ? '1' : '2', $/;
    
  2. or download this
    $ perl -Mstrict -Mwarnings -e '
        for my $item_count (0..2) {
    ...
    0 items.
    1 item.
    2 items.
    
  3. or download this
    my $arrref =  \( if(1<2){'1'}else{()} );
    
  4. or download this
    $arrayref = \(...);
    
  5. or download this
    $arrayref = [...];
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-05-23 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?