#!/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";