This gathers the same information (ie. counts character at position in the string), and runs roughly 40 times faster.
(Faster still if you don't need the tr///).
my %c; $string =~ tr[ACGT][N]c; $c{ substr $string, $_, 1 }[ $_ ]++ for 0 .. length( $string )-1;
In reply to Re: Iterating over string
by BrowserUk
in thread Iterating over string
by danielfortin86
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |