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


in reply to Using constants in regexes?

Use the (?{ CODE }) experimental feature at your own risk:
use constant TEST => 'def'; my $string = 'abcdefg'; if ($string =~ /(?{TEST})/) { print "The string contains the constant.\n"; }else{ print "The string doesn't contain the constant.\n"; }

Aziz,,,