title: How can I use a variable in the replacement side of the Perl substitution operator?
body: <p>I would like to do the following:</p>
  <pre><code>$find = &quot;start (.*) end&quot;;
  $replace = &quot;foo \1 bar&quot;;
  
  $var = &quot;start middle end&quot;;
  $var =~ s/$find/$replace/;
  </code></pre>
  <p>I would expect $var to contain &quot;foo middle bar&quot;, but it does not work. Neither does:</p>
  <pre><code>$replace = 'foo \1 bar';
  </code></pre>
  <p>Somehow I am missing something regarding the escaping.</p>