#!/usr/bin/perl use warnings; use strict; my $txt = '1,2'; my $fix = 0; $txt =~ s/(\d+)\.(\d+)/$1$fix,$2/; print "$txt\n";