>perl -wMstrict -le "my $s = 'foo bar fooo bar foooo bar'; my $cc = 'foz'; ;; my $count = ($s =~ tr/$cc//); print $count; ;; $count = '$c$c$' =~ tr/$cc//; print $count; ;; $count = $s =~ tr/foz//; print $count; ;; $count = $s =~ s{ ([$cc]) }{$1}xmsg; print $count; ;; $count =()= $s =~ m{ [$cc] }xmsg; print $count; ;; $count = $s =~ s{ [$cc] }{}xmsg; print $count; print qq{'$s'}; " 0 5 12 12 12 12 ' bar bar bar'