title: How to refer to the last capture group inside Perl code embedded in regex via (?{...})?
body: <p>I would like to be able to use the last capture group in the Perl code embedded via <code>(?{...})</code></p>
  <pre><code>'foobar' =~ /(oo)(bar)(?{ $word = ${-1} })/
  </code></pre>
  <p>My attempt above fails. I want the variable <code>$word</code> to have the string <code>bar</code> after the regex.</p>