I think you are looking for quotemeta or \Q and \E. See perlre.
In reply to Re: Pattern matching with a variable by JediWizard in thread Pattern matching with a variable by Anonymous Monk