in reply to Maybe Escape in Dynamic RegExps
The simplest way would be to use the \Q and \E in the expression:
$re= qr(/($<!\Q$a\E)\Q$b/); [download]
/J\