I am not sure I understand the question. Can it be reformulated as: get all 2^10 combinations of 1s and 2s and insert them after each letter in the given string? For this question the answer would be:
use strict; use warnings; my $string = "ATATGCGCAT"; my @letters = split '', $string; for( my $i=0; $i<2**@letters; ++$i ) { my $b = sprintf("%010b",$i); $b=~tr/01/12/; for( my $j=0; $j<@letters; ++$j ) { print $letters[$j],substr $b, $j, 1; } print "\n"; last if $i==20; # remove if you want all... }
In reply to Re: How can one get all possible combinations of a string without changing positions & using window size?
by hdb
in thread How can one get all possible combinations of a string without changing positions & using window size?
by supriyoch_2008
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |