⭐ in reply to Using constants in regexes?
use constant PATTERN => qr/def/; if ($string =~ PATTERN) { ... } [download]
if ($string =~ /this@{[ PATTERN ]}that/) { ... } [download]