http://www.perlmonks.org?node_id=528120


in reply to Perl Idioms Explained - my $count = () = /.../g

Something else worth noting is that in the event of counting the amount of single characters tr() can be used.
my $str = "here are some words"; my $count = $str =~ tr/e/e/; print "We sure do have a lot of e characters: $count\n";