title: How to search and replace string in a file in Perl
body: <p>The content of my input file is shown below:</p>
  <pre class="lang-none prettyprint-override"><code>abc\**def\ghi**\abc\!!!!!
  abc\**4nfiug\frgrefd\gtefe\wf4fs**\abc\df3gwddw
  abc\**eg4/refw**\abc\f3
  </code></pre>
  <p>I need to replace whatever string in between <code>abc \ --------------\abc</code> in my input file with <code>ABC\CBA</code>.</p>
  <p>I have tried something like below to get the strings that need to be replaced. But I get stuck when I need to use the search and replace:</p>
  <pre><code>my $string1 = qr/abc\W+([^a]+)/;
  my $string2 = map{/$string1/ =&gt; &quot; &quot;} @input_file; # The string that needs to be replaced
  my $string3 = 'ABC\CBA'  # String in that. I want it to replace to
  
  s/$string2/$string3/g
  </code></pre>
  <p>How can I fix this?</p>