<?xml version="1.0" encoding="windows-1252"?>
<node id="104059" title="Using constants in regexes?" created="2001-08-10 22:31:11" updated="2005-08-10 10:24:40">
<type id="1857">
categorized question</type>
<author id="11732">
QandAEditors</author>
<data>
<field name="doctext">
If I were to create something like
&lt;code&gt;
use constant TEST =&gt; 'def';
my $string = 'abcdefg';

if ($string =~ /TEST/) {
   print "The string contains the constant.\n";
}else{
   print "The string doesn't contain the constant.\n";
}
&lt;/code&gt;
It's awfully hard for the interpreter to know that &lt;code&gt;TEST&lt;/code&gt; is actually a constant, because to the regex engine it's just another string.  The &lt;code&gt;/e&lt;/code&gt; modifier doesn't work.  Is there a way to do this?
</field>
<field name="parent_node">
1835</field>
</data>
</node>
