The problem is that you're using single quotes to define $re
. That means that when you use it in the search pattern it looks for two slashes.
Single quotes tell Perl not to interpolate the strings, but to use the raw characters instead. Each slash is taken literally and as an escape.
Compare:
$re0 = 'a\\cc';
$re1 = "a\\cc";
When you print them out you'll see:
print $re0."\n".$re1."\n";
a\\cc
a\cc
On the other hand, when you use the string directly in the regex, it's interpolated, so you need one slash to act as an escape, and another to be what you're escaping.