http://qs321.pair.com?node_id=11106739


in reply to Re: Printing from three arrays
in thread Printing from three arrays

Nested loops become unwieldy when you have many arrays. With a suitable module it does not matter how many dimension the input has:
use 5.010; use Set::Scalar qw(); my $iter = Set::Scalar->cartesian_product_iterator( map { Set::Scalar->new(@$_) } [1, 2, 3], [qw/a b c/], [qw/I II III/], ); while (my @m = $iter->()) { say "@m"; }
There are numerous alternatives: https://metacpan.org/search?q=cartesian+product
Bonus:
use v6; .say for cross (1, 2, 3), <a b c>, <I II III>