in reply to Challenge: Generate fixed size combination across groups without duplicates

I tried Math::Combinatorics:
#!/usr/bin/perl use strict; use warnings; use Math::Combinatorics; my(@aoa) = ( qw(A B C), qw(1 2 3 4), qw(yellow blue green), qw(tiny small medium large gigantic), ); my @n = combine(2, @aoa); print "[", join(", ", @$_), "]\n" for @n;
  • Comment on Re: Challenge: Generate fixed size combination across groups without duplicates
  • Download Code

Replies are listed 'Best First'.
Re^2: Challenge: Generate fixed size combination across groups without duplicates
by Limbic~Region (Chancellor) on Nov 17, 2011 at 03:07 UTC
    Khen1950fx,
    This fails to produce a correct solution. The last output is: [large, gigantic] which is two items from the same group.

    Cheers - L~R