title: How to replace the a number with another using regular expression
body: <p>I have a file named files, which contain</p>
  
  <pre><code>100-1-0_Message1_Tableau_problem.txt
  1001-1-0_EDM_Queries_v2.mdb
  1001-1-0_geocodes.xlsx
  1001-1-0_losstypes.xlsx
  1001-10-0_Exposure_Analysis_Tables_Needed.xlsx
  </code></pre>
  
  <p>I want to replace this file by incrementing the first part of the file name. i.e 001-1-0_EDM_Queries_v2.mdb to 1002-1-0_EDM_Queries_v2.mdb. Below regular expression with perl fails to do this.</p>
  
  <pre><code>perl -e '@lines = &lt;&gt;;foreach $f (@lines){$n = $f; $n=~s/^(\d+)/$1+1/g; print $n}' files
  </code></pre>
  
  <p>It prints </p>
  
  <pre><code>100+1-1-0_Message1_Tableau_problem.txt
  1001+1-1-0_EDM_Queries_v2.mdb
  1001+1-1-0_geocodes.xlsx
  </code></pre>
  
  <p>How do I tell the regular expression to add +1 instead of appending?</p>