Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: conditional statements in list constructors

by SuicideJunkie (Vicar)
on Mar 27, 2014 at 14:59 UTC ( #1079939=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $pi = 0;
    my $life = 'isgood';
    my $foo = 1;
    my $aref = [ (3,1,4) x !!($pi), (42) x !!($life), ('bar', 'baz') x !!(
    +$foo)  ];
    print Dumper $aref;
    
  2. or download this
    $VAR1 = [
              42,
              'bar',
              'baz'
            ];
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-05-21 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?