local $_ = $string; my $total; for my $letter (qw(A C G T)) { my $count =()= /$letter/g; print "$letter: $count\n"; $total += $count; } my $other = length($_) - $total; print "Other: $other\n"; #### local $_ = $string; local %count; s/([ACGT])/$count{$1}++;$1/ge;