in reply to More while issues

$string =~ tr/H// returns the number of times the character 'H' occurs in a string.

$string =~ tr/G//d; removes all occurances of the character 'G'.

See tr/SEARCHLIST/REPLACEMENTLIST/cds in perldoc perlop.