in reply to Strange backslash in regexp behaviour

"\\B" is a backslash followed by a B. The regexp engine considers that an zero-width check (not a word/non-word boundary). But A isn't followed by a letter.

Use $x = qr/A\\B/ instead.