note
BillKSmith
<p>
A much shorter solution (probably slower) uses a regexp to copy all the A's to a temp array and then uses the size of that array as the count. Repeat for other letters.
</p>
<code>
use strict;
use warnings;
use Data::Dumper qw(Dumper);
my @letters = ('A', 'T', 'G', 'C', '-');
while (my $seq = <>){
print $seq;
my @temp;
my %cnts = map {($_, scalar ( @temp = $seq =~ /($_)/g))} @letters;
print Dumper \%cnts;
}
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-957973">
Bill
</div></div>
1007821
1007821