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

Re: Variable number of foreach loops (non-recursive solution)

by smls (Friar)
on Nov 28, 2013 at 17:44 UTC ( [id://1064853]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub nested_foreach(&@) {
      my $code = shift;
    ...
    my @c = ...;
    
    nested_foreach { say join ' ', @_ } \@a, \@b, \@c;
    
  2. or download this
    sub nested_foreach(&@) {
      ... # see above
    ...
        iterative => sub { nested_foreach { join("", @_) } @AoA },
        recursive => sub { nForX { join("", @_) } scalar @AoA, @AoA },
    };
    
  3. or download this
              s/iter iterative recursive
    iterative   1.86        --      -71%
    recursive  0.532      249%        --
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found