in reply to Maybe Escape in Dynamic RegExps

Just escape them via the quotemeta() function or, better yet, using \Q and \E:
$re = qr(/($<!\Q$a\E)\Q$b\E/);