use strict; use Permute; my $string = 'RAGGTS'; $string =~ s/S/\[C,G\]/g; $string =~ s/R/\[A,G\]/g; $string =~ s/K/\[G,T\]/g; # $string now becomes: [A,G]AGGT[C,G] my $seq = Permute->New($string); # get one at a time while (my $out = $seq->Next){ print "$out \n"; } # or all at once my @allofthem = $seq->All;