Win8 Strawberry 5.8.9.5 (32) Fri 08/19/2022 19:42:14 C:\@Work\Perl\monks >perl use strict; use warnings; my $txt = "C:\\Book\\C0001-Chapter-001.mp3"; my $new = "C:\\Book\\NEW-C0001-Chapter-001.mp3"; print "\n"; print "Before: '$txt' \n"; # Workaround -- use \Q \E -- see quotemeta. $txt =~ s/\Q$txt\E/$new/; print "After: '$txt' \n"; print "\n"; ^Z Before: 'C:\Book\C0001-Chapter-001.mp3' After: 'C:\Book\NEW-C0001-Chapter-001.mp3'