in reply to Combinations / permutations... not even sure what this is called

I counted 126 possible combinations using Math::Combinatorics.
#!/usr/bin/perl use strict; use warnings; use Math::Combinatorics; my @arrays = ( qw[ red blue ], qw[ small medium large ], qw[ 1 2 3 4 ], ); print "combinations of 4 from: ".join(" ",@arrays)."\n"; print "-----------------------------".("--" x scalar(@arrays))."\n"; print join("\n", map { join " ", @$_ } combine(4,@arrays))."\n";
  • Comment on Re: Combinations / permutations... not even sure what this is called
  • Download Code

Replies are listed 'Best First'.
Re^2: Combinations / permutations... not even sure what this is called
by JavaFan (Canon) on Oct 29, 2011 at 07:46 UTC
    I counted 126 possible combinations using Math::Combinatorics
    Considering 126 != 4 * 3 * 2, I'm claiming that your answer is wrong, without even looking at the code, or its output.