in reply to Arbitrary Levels Of Recursion?

This kind of does what you want for arbitary levels and it really recurses.

#!/usr/bin/perl use warnings; use strict; sub curse { my $arrays = shift; my $index = shift || 0; my $list = shift || []; my $handling = $arrays->[$index]; print "cursing ", scalar @$arrays, " level(s)\n" unless $index; foreach (@$handling) { push @$list, $_; if (($index+1) < @$arrays) { recurse($arrays, ($index+1), $list) } else { print +(join ",",@$list), $/; } pop @$list; } print $/ unless $index; } *recurse=\&curse; # sorry, my little joke ;) my @a=qw(this that); my @b=qw(foo bar baz); my @c=(1..3); my @d=qw(how many roads); curse([\@a]); curse([\@a, \@b]); curse([\@a, \@b, \@c]); curse([\@a, \@b, \@c, \@d]);

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!