The \ needs to be quoted. It is an 'escape' character that allows you to treat special characters normally and normal characters specially. In this case it is quoting the }, which is not what you want.
use warnings; use strict; my $str = 'c:/windows/'; $str =~ tr{/}{\\}; print $str;
Prints:
c:\windows\
In reply to Re^3: change forward slash to backslash
by GrandFather
in thread change forward slash to backslash
by Eric23
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |