I was wondering if there was a faster way of recording the number of instances of a letter at a given position? Basically, the code below does what I'd like to do, but I'd like it to be faster since it will be run quite often. Any suggestions?
@seq = split(//,$string); $i = 0; foreach$letter(@seq){ switch($letter){ case "A" { $A[$i]++;} case "C" { $C[$i]++; } case "G" { $G[$i]++;} case "T" { $T[$i]++; } else{$N[$i]++;} } $i++; }
In reply to Iterating over string by danielfortin86
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |