Not sure it helps a lot in your case, but this is one possible way to generate permutations in this session under the Perl debugger:
DB<1> @array=qw/a b c d/ DB<2> $stringified = join ',', @array; DB<3> @permutations = glob "{$stringified}" x 2; DB<4> map {s/(.)(.)/$1-$2/} @permutations DB<5> x @permutations 0 'a-a' 1 'a-b' 2 'a-c' 3 'a-d' 4 'b-a' 5 'b-b' 6 'b-c' 7 'b-d' 8 'c-a' 9 'c-b' 10 'c-c' 11 'c-d' 12 'd-a' 13 'd-b' 14 'd-c' 15 'd-d'
Of course, in your case, additional filtering would be necessary. I think that the modules mentionned by other monks are probably a better solution.
In reply to Re: How can one find out the pairwise difference and product between elements in a perl array without using a perl module?
by Laurent_R
in thread How can one find out the pairwise difference and product between elements in a perl array without using a perl module?
by supriyoch_2008
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |