in reply to Counting how many times a character is in a string.

my $pcount = $str =~ tr/%//;

See tr.

Makeshifts last the longest.