title: Cannot increment build number in file
body: <p>I'd like to increment the build number in a file as part of the build process.</p>
  
  <p>The intent of the script is to search for <code>.###'/* BUILD-NUMBER */</code>, as in:</p>
  
  <pre><code>console.log('Version 1.1.017'/* BUILD-NUMBER */);
  </code></pre>
  
  <p>Parse out the <code>017</code>, add one, then <code>sprint</code> it back. This is the code I have:</p>
  
  <pre><code>perl -pe "s~\.([0-9]+)'/\* BUILD-NUMBER \*/~(sprintf('.%03d%c/* BUILD-NUMBER */', $1, 39))~e" &lt; $U &gt; $T
  </code></pre>
  
  <p>The <code>39</code> is to match with <code>%c</code> to print an apostrophe <code>'</code> because I couldn't figure out how to put one in literally. (It goes into a bash script.)</p>
  
  <p>Anyway, when I run the above, it comes back:</p>
  
  <pre><code>console.log('Version 1.1.001'/* BUILD-NUMBER */);
  </code></pre>
  
  <p>So, I think it's not getting the number. I tried <code>$0</code>, <code>$1</code>, <code>\g1</code>, etc. but it brings back some weird stuff. Not seeing <code>17</code> anywhere.</p>
  
  <p>Also, will the leading zeroes in the build number force <code>perl</code> to interpret the string as octal? (The reason for using <code>017</code> as the test case, to see if it comes back as <code>016</code> or <code>018</code>.)</p>