title: Why are `\Q` `\E` in a Perl pattern in some cases interpreted as literal `Q` `E`?
body: <p>If <code>'</code> is the delimiter, or if interpolated from a variable, the regular expression <code>\QW\ER</code> matches <code>QWER</code> and not <code>WR</code> (observed with v5.6.2, v5.10.1 and v5.18.2 of Perl and at <a href="http://www.perlfect.com/articles/regextutor.shtml" rel="nofollow">http://www.perlfect.com/articles/regextutor.shtml</a>), i. e., <code>\Q</code> <code>\E</code> in the pattern are not interpreted as a quoting escape, but as literal <code>Q</code> <code>E</code>.</p>
  
  <p>Example:</p>
  
  <pre><code>#!/usr/bin/env perl
  $re = '\QW\ER';
  print '$re = ', $re, "\n";
  while (&lt;DATA&gt;)
  {
      print qw(/\QW\ER/), "  matches ", $_ if /\QW\ER/;
      print qw(m'\QW\ER'), " matches ", $_ if m'\QW\ER';
      print qw(/$re/), "     matches ", $_ if /$re/;
  }
  __DATA__
  QWERT
  WRONG
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>$re = \QW\ER
  m'\QW\ER' matches QWERT
  /$re/     matches QWERT
  /\QW\ER/  matches WRONG
  </code></pre>
  
  <p>(Only the last line is what I had expected.)</p>
  
  <p>Is this a bug? ... a feature? ... documented anywhere?</p>