http://www.perlmonks.org?node_id=1210725


in reply to Is there any way to put regex modifiers into a variable?

You can compile an arbitrary string into a variable which contains a regular-expression. The value of this variable can be subsequently used to match things. See qr// under perldoc perlop ("Regexp Quote-Like Operators"). **EDIT** "qr" not "qx!" Oops.