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