Two problems that I see.
Your first problem is that your s/// replacement is not complete:
s/hello/c:\foo # fatal syntax error: "Substitution replacement not terminated" s/hello/c:\foo/
The second problem you asked for is that \f is taken as a feed escape sequence (ASCII 0x0C), just like it would be in double quotes, which you don't want.
You can either avoid the backslash, or let the interpolation of variables βhideβ the problem:
s!hello!c:\\foo!
Take a look at the treatment of Quote and Quote perlop in perlop for more information.
source share