use warnings; use strict; my $str = 'c:/windows/'; $str =~ tr{/}{\\}; print $str; #### c:\windows\