Here is a simple example from some preexisting code. It uses the built-in 'glob' function. It does not check against requirement 2, but it should be enough to get you started.
### <region-file_info> ### main: ### - name : trySimpleCombinations000.pl ### sbty : perl ### desc : generate simple combinations from separate arra +ys ### </region-file_info> ### begin_: init perl use strict; use warnings; ### begin_: init vars my @aColor = qw(Red White Blue); my @aAnimal = qw(Cat Rat Dog Mouse); my @aLetter = qw(Alpha Bravo Charlie); my @aDigit = qw(0 1 2 3 4); my @aResult = (); ### begin_: generate combis @aResult = glob ( "{@{[join',',@aColor]}}" ."{@{[join',',@aAnimal]}}" ."{@{[join',',@aLetter]}}" ."{@{[join',',@aDigit]}}" ); ### begin_: show the results print join "\n", @aResult; print ("\n-----------------------------------\n"); 1; __END__ RedCatAlpha0 RedCatAlpha1 RedCatAlpha2 RedCatAlpha3 RedCatAlpha4 RedCatBravo0 . . . BlueMouseCharlie0 BlueMouseCharlie1 BlueMouseCharlie2 BlueMouseCharlie3 BlueMouseCharlie4
In reply to Re: Combinations of an array of arrays...?
by dimar
in thread Combinations of an array of arrays...?
by doowah2004
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |