Matching against a variable is mentioned in perlre and is the fourth example in perlre. Perhaps the official documentation is where you should have looked first
Unless I state otherwise, all my code runs with strict and warnings
Comment on Re: Regexes that use a string as basis for matching