in reply to using constants in regex/search

I realize that your example is most likely reduced from something more interesting. However, in this case, another solution exists. Treat the constant as a regex (well a runtime-interpolated search pattern really) in stead of interpolating it into one. Example:

use constant NAME => 'abc'; # ... if ($input =~ NAME) { print "Matched!" }