in reply to regexp $1 in a variable

change
$b='\Qa(.)\E';
and it will work


UPDATE: wrong thought