use strict; # Single quote string, and back-whack the backslashes # to avoid misinterpretation (by readers, if not by perl). my $strInputFileName = 'D:\\direcorty\\file.ext'; # Globally replace backslashes with four backslashes. # Note that these all need backwhacking too, since # regex acts somewhat like a quoted string. $strInputFileName =~ s{\\}{\\\\\\\\}g;