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


in reply to Using constants in regexes?

The /e modifier is for the right-hand side of a s/// only. You might want to just leave out the slashes.
use constant PATTERN => qr/def/; if ($string =~ PATTERN) { ... }
Or, if you need to embed a constant, use the array dereference-reference trick:
if ($string =~ /this@{[ PATTERN ]}that/) { ... }