in reply to most terse regex match count

You want 3/4ths of the operator which shall not be named and some extra parens.

if( 2 == ( ()= $outs =~ m|A|gs ) ){ print "exactly 2 matches\n" }

The cake is a lie.
The cake is a lie.
The cake is a lie.