$_ = "abacadaeafag"; # or whatever if ( scalar( () = /a/g ) > 7 ) { # more than 7 'hits'? # do something... }