use 5.010; my $str1 = 'MALSSTAATTSSKLKLSNPPSLSHTFTASASASVSNSTSFR'; my $a_count = $str1 =~ tr/A/A/; # 6