$string =~ tr{/}{\};
Or with the substitution operator:
$string = s{/}{\}g;
tr/// is going to be a little faster, but s/// would let you create more complex matching and replacing criteria.
For further reading, see perlop. There you'll find an explanation of the s/// and tr/// operators. Also see perlre for a more detailed discussion of what you can do with the s/// operator.
Update:Oops... yes, those pesky backslash characters need to be doubled up thanks to the gory details of quote parsing. tr{/}{\\}, for example. Sorry about that. ;)
|