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


in reply to Count the number of matched characters

Another way is to do this:
() = substr($_,-17) =~ / A (?{ print 'yes' if $::i++>12}) /xg;