http://www.perlmonks.org?node_id=938508


in reply to Re^2: Challenge: Generate fixed size combination across groups without duplicates
in thread Challenge: Generate fixed size combination across groups without duplicates

I arrived at the same solution:
use Algorithm::Loops; use Math::Combinatorics; my $fixed_size = 2; my @groups = ( [qw( A B C )], [qw( 1 2 3 4 )], [qw( yellow blue green )], [qw( tiny small medium large gigantic )], ); for my $fixed_size_groups ( combine( $fixed_size, @groups ) ) { Algorithm::Loops::NestedLoops $fixed_size_groups, sub { print "@_\n"; }; }