title: Perl regex: replace all backslashes with double-backslashes
body: <p>Within a set of large files, I need to replace all occurrences of "<code>\</code>" with "<code>\\</code>".  I'd like to use Perl for this purpose.  Right now, I have the following:</p>
  
  <pre><code>perl -spi.bak -e '/s/\\/\\\\/gm' inputFile
  </code></pre>
  
  <p>This command was <a href="https://stackoverflow.com/questions/971859/improving-my-file-i-o-algorithm/971939#971939">suggested</a> to me, but it results in no change to inputFile (except an updated timestamp). Thinking that the problem might be that the "<code>\</code>"s were not surrounded by blanks, I tried</p>
  
  <pre><code>perl -spi.bak -e '/s/.\\./\\\\/gm' inputFile
  </code></pre>
  
  <p>Again, this had no effect on the file.  Finally, I thought I might be missing a semicolon, so I tried:</p>
  
  <pre><code>perl -spi.bak -e '/s/.\\./\\\\/gm;' inputFile
  </code></pre>
  
  <p>This also has no effect.  I know that my file contains "<code>\</code>"s, for example in the following line:</p>
  
  <pre><code>(&amp;quot;C:\WINDOWS\system32\iac25_32.ax&amp;quot;,&amp;quot;Indeo audio)
  </code></pre>
  
  <p>I'm not sure whether there is a problem with the regex, or if something is wrong with the way I'm invoking Perl.  I have a basic understanding of regexes, but I'm an absolute beginner when it comes to Perl.</p>
  
  <p>Is there anything obviously wrong here?  One thing I notice is that the command returns quite quickly, despite the fact that inputFile is ~10MB in size.</p>