title: Detect difference of match in list context with a capturing vs non-capturing regexp?
body: <p>According to <a href="http://perldoc.perl.org/perlretut.html#Extracting-matches" rel="nofollow">perlretut</a></p>
  
  <blockquote>
    <p>... in scalar context, <code>$time =~ /(\d\d):(\d\d):(\d\d)/</code> returns a true or false value. In list context, however, it returns the list of matched values <code>($1,$2,$3)</code> .</p>
  </blockquote>
  
  <p>But I can't find an explanation of what is returned in list context if the pattern matches when there are no capturing groups in the regexp. Testing shows that it is the list <code>(1)</code> (single element, integer 1). (Ancillary question - will it always be this, where is it defined?)</p>
  
  <p>This makes it difficult to do what I want:</p>
  
  <pre><code>if (my @captures = ($input =~ $regexp)) {
      furtherProcessing(@captures);
  }
  </code></pre>
  
  <p>I want <code>furtherProcessing</code> to be called if there is a match, with any captured groups passed as arguments. The problem comes when the <code>$regexp</code> contains no capturing groups because then I want <code>furtherProcessing</code> to be called with no arguments, not with the value <code>1</code> which is what happens in the above. I can't test for <code>(1)</code> as a special case, like this</p>
  
  <pre><code>if (my @captures = ($input =~ $regexp)) {
      shift @captures if $captures[0] == 1;
      furtherProcessing(@captures);
  }
  </code></pre>
  
  <p>because in the case of</p>
  
  <pre><code>$input = 'a value:1';
  $regexp = qr/value:(\S+)/;
  </code></pre>
  
  <p>there is a captured value in <code>@captures</code> that happens to look the same as what I get when the <code>$regexp</code> matches but has no capturing groups.</p>
  
  <p>Is there a way to do what I want?</p>