title: Perl regex: how to know number of matches
body: <p>I'm looping through a series of regexes and matching it against lines in a file, like this:</p>
  
  <pre><code>for my $regex (@{$regexs_ref}) {
      LINE: for (@rawfile) {
          /@$regex/ &amp;&amp; do {
              # do something here
              next LINE;
          };
      }
  }
  </code></pre>
  
  <p>Is there a way for me to know how many matches I've got (so I can process it accordingly..)?</p>
  
  <p>If not maybe this is the wrong approach..? Of course, instead of looping through every regex, I could just write one recipe for each regex. But I don't know what's the best practice? </p>