title: Returning line numbers of a regex match across multiple lines
body: <p>I'm trying to write a tool that will find empty XML tags which are spanned across multiple lines in a large text file. E.g. don't match:</p>
  
  <pre><code>&lt;tag&gt;
  ABC
  &lt;/tag&gt;
  </code></pre>
  
  <p>And match:</p>
  
  <pre><code>&lt;tag&gt;
  &lt;/tag&gt;
  </code></pre>
  
  <p>I have no problem in writing the regex to match whitespace across multiple lines, but I need to find the line numbers where these matches occur (approximately at least).</p>
  
  <p>I would split my text file into an array, but then it'll be pretty tricky to match across multiple array elements as there may be > 2 lines of tags/whitespace.</p>
  
  <p>Any ideas? My implementation needs to be in Perl. Thanks!</p>