For replacing a single, known character, then regular expressions are the wrong tool. You need the tr/// operator as has already been pointed out.
The difference in performance is impressive:
$ cat bench
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark 'cmpthese';
sub regex_subst {
$_ = 'this/is/a/string';
s|/|\\|g;
}
sub tr_subst {
$_ = 'this/is/a/string';
tr|/|\\|;
}
cmpthese(1_000_000, {
s => \®ex_subst,
tr => \&tr_subst,
});
$ ./bench
Rate s tr
s 287356/s -- -75%
tr 1162791/s 305% --
$