my $doc = 'This /and/ that.'; $doc =~ s!/!\\!g; print $doc; #### This \and\ that.