azheid has asked for the wisdom of the Perl Monks concerning the following question:
Perl Monks, please help. I want to generate all possible string combinations of N arrays. I am sure that there are several hundred ways that you guys could come up with to accomplish this. I only need one and it does not have to be efficient
A minimized version of my non-working solution is as follows:
my $string='echo {CAT,CAC}TGG{GTT,GTC,GTA,GTG}{CCT,CCC,CCA,CCG}'; my $combinations=`$string`; print $combinations;
The result that I want is
CATTGGGTTCCT CATTGGGTTCCC CATTGGGTTCCA CATTGGGTTCCG CATTGGGTCCCT CATTGGGTCCCC CATTGGGTCCCA CATTGGGTCCCG CATTGGGTACCT CATTGGGTACCC CATTGGGTACCA CATTGGGTACCG CATTGGGTGCCT CATTGGGTGCCC CATTGGGTGCCA CATTGGGTGCCG CACTGGGTTCCT CACTGGGTTCCC CACTGGGTTCCA CACTGGGTTCCG CACTGGGTCCCT CACTGGGTCCCC CACTGGGTCCCA CACTGGGTCCCG CACTGGGTACCT CACTGGGTACCC CACTGGGTACCA CACTGGGTACCG CACTGGGTGCCT CACTGGGTGCCC CACTGGGTGCCA CACTGGGTGCCG
The code returns {CAT,CAC}TGG{GTT,GTC,GTA,GTG}{CCT,CCC,CCA,CCG}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: System Command using Bash Expansion
by kcott (Archbishop) on Mar 30, 2014 at 03:43 UTC | |
|
Re: System Command using Bash Expansion
by eye (Chaplain) on Mar 30, 2014 at 03:22 UTC | |
|
Re: System Command using Bash Expansion
by karlgoethebier (Abbot) on Mar 30, 2014 at 13:15 UTC | |
|
Re: System Command using Bash Expansion
by Anonymous Monk on Mar 30, 2014 at 02:34 UTC | |
|
Re: System Command using Bash Expansion
by Anonymous Monk on Mar 30, 2014 at 18:58 UTC |