title: Distinguishing and substituting decimals in Perl
body: <p>I want to substitute decimals from commas to fullstops in a file and I wanted to try to do this in perl. 
  An example of my dataset looks something like this:</p>
  
  <pre><code>Species_1:0,12, Species_2:0,23, Species_3:2,53
  </code></pre>
  
  <p>I want to substitute the decimals but not all commas such that:</p>
  
  <pre><code>Species_1:0.12, Species_2:0.23, Species_3:2.53
  </code></pre>
  
  <p>I was thinking it might work using the substitution function like such: </p>
  
  <pre><code>$comma_file= "Species_1:0,12 , Species_2:0,23, Species_3:2,53"
  
      $comma = "(:\d+/,\d)";
  #match a colon, any digits after the colon, the wanted comma and digits preceding it
         if ($comma_file =~ m/$comma/g) {
             $comma_file =~ tr/,/./;
          }
  print "$comma_file\n"; 
  </code></pre>
  
  <p>However, when I tried this, what happened was that all my commas changed into fullstops, not just the ones I was targetting. Is it an issue with the regex or am I just not doing the match substitution correctly?</p>
  
  <p>Thanks!</p>