Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict;
    ...
    nFor {
        print join '', @digits[ @_ ];
    } ( 3 ) x 4;
    
  2. or download this
    apple, dog, 1
    apple, dog, 2
    ...
    tomato, platypus, 1
    tomato, platypus, 2
    tomato, platypus, III
    
  3. or download this
    # Variable number of lists of variable length
    my @lists = (
    ...
       [qw( dog cat platypus )],
       [qw( 1 2 III )],
    );
    
  4. or download this
    local $, = ", ";
    local $\ = "\n";
    NestedLoops(\@lists, sub { print @_ });
    
  5. or download this
    local $, = ", ";
    local $\ = "\n";
    nFor { print map $lists[$_][ $_[$_] ], 0..$#_; } map 0+@$_, @lists;
    
  6. or download this
    sub nested(&@) {
        my $cb = shift;
    ...
    local $, = ", ";
    local $\ = "\n";
    nested { print @_; } @lists;