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

"Nonliteral literal" is just an expression.

by rir (Vicar)
on Sep 24, 2019 at 04:40 UTC ( [id://11106621]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $ar = [ [ 'HEAD_goes_here', 'BODY_here' ],
               [ 'FOOT', 'FOOT', 'FOOT', 'FOOT' ]
    ];
    
  2. or download this
     my $scalars_flattened = [ \$ar->[0][0], \$ar->[0][1],
         \$ar->[1][0], \$ar->[1][1], \$ar->[1][2], \$ar->[1][3] ];
    
  3. or download this
     my @flat = @{$_[0]};
     while ( List::Util::any { 'ARRAY' eq ref $_ } @flat ) {
            @flat = map { 'ARRAY' eq ref $_ ? \(@$_) : \$_ } @flat;
            @flat = map { 'REF' eq ref $_   ? $$_    : $_ } @flat;
     }
    
  4. or download this
     $ar = [ 'HEAD', 'BODY', [ 'FOOT', 'FOOT', 'FOOT', 'FOOT'], ];
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found