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