in reply to Trying to construct all possible strings from 4 bases [ATCG]
Using Math::BaseCalc, here's a simple solution (untested):
use Math::BaseCalc; $calc4 = new Math::BaseCalc(digits=>[qw/A T C G/]); print($calc4->to_base($_), "\n") for 0 .. 4 ** $L - 1;
(You probably need to left-pad the string with 'A's to length L. Here 'A' maps to 0.)
Update: Good catch, ++jdalbec (fixed off-by-one bug).
|
|---|