in reply to Trying to construct all possible strings from 4 bases [ATCG]
On the basis that you're more interested in getting the results rather than doing it yourself you may want to use the String::Combination module on CPAN which does what you need.
The following code seems to do the job..
#!/usr/bin/perl use strict; use warnings; use String::Combination; # Get all the combinations of bases which have a prescribed length. my $length=2; my @combinations=String::Combination::combination('atcg',$length); # Output the results. print "$_\n" for @combinations;
|
---|
In Section
Seekers of Perl Wisdom