# The s/// operates on $copy. (my $copy = $str) =~ s/\\/\\\\/g;