Many variations are possible. I think there are some good ideas in this thread.#!/usr/bin/perl -w use strict; use Data::Dumper; my @array; foreach my $prefix (glob "{red,blue}-{small,medium,large}") { my @sub_array; push @sub_array, "$prefix-$_" for (1,2,3,4); push @array, \@sub_array; } print Dumper \@array; __END__ $VAR1 = [ [ 'red-small-1', 'red-small-2', 'red-small-3', 'red-small-4' ], [ 'red-medium-1', 'red-medium-2', 'red-medium-3', 'red-medium-4' ], [ 'red-large-1', 'red-large-2', 'red-large-3', 'red-large-4' ], [ 'blue-small-1', 'blue-small-2', 'blue-small-3', 'blue-small-4' ], [ 'blue-medium-1', 'blue-medium-2', 'blue-medium-3', 'blue-medium-4' ], [ 'blue-large-1', 'blue-large-2', 'blue-large-3', 'blue-large-4' ] ];
In reply to Re^3: Combinations / permutations... not even sure what this is called
by Marshall
in thread Combinations / permutations... not even sure what this is called
by tunafish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |