\ is special in string literals (pieces of code that build strings, incl the replacement expression of s///) and in regex patterns. Escaping it with another
\ will cause it to be treated literally.
for (
'8\\\\.', # 8\\.
'8__BACKSLASH__.',
) {
my $s = $_;
$s =~ s/\\\\|__BACKSLASH__/\\/g;
print "$s\n";
}
8\.
8\.