title: Replace specific capture group instead of entire regex in Perl
body: <p>I've got a regular expression with capture groups that matches what I want in a broader context. I then take capture group <code>$1</code> and use it for my needs. That's easy.</p>
  <p>But how to use capture groups with <code>s///</code> when I just want to replace the content of <code>$1</code>, not the entire regex, with my replacement?</p>
  <p>For instance, if I do:</p>
  <pre><code>$str =~ s/prefix (something) suffix/42/
  </code></pre>
  <p><code>prefix</code> and <code>suffix</code> are removed. Instead, I would like <code>something</code> to be replaced by <code>42</code>, while keeping <code>prefix</code> and <code>suffix</code> intact.</p>