in reply to Matching brackets in Regular Expression

Using the quotemeta function is probably a good suggestion ...

Is there any reason why you don't want to drop the

.*

from both ends of the regex ????

My understanding is that using:

if ($text =~ /$stub/s)
will recognize any occurence of $stub

Without knowing more about your intentions, it would seem difficult to offer detailed fine tuning advice.