How do you you use a variable in a regular expression and still use the format of regular expression?
Such as:
$word = "cccv";
$pat = "[^aeiou][^aeiou][^aeiou][aeiou]";
if($word =~ /($pat)/{
$yep++;
}
How do I get $pat to be treated as a normal reg expression?
The reason for this wierd idea, is that I have to match words in a dictonary in the form of c = consonat
and v = vowel. So, I have a user input something like 'ccvv' and I just subsitute the reg expression for each letter (i.e.
s/v/[aeiou]/g;)and want to use it in that way, but it doesn't want to work.
Thanks,
P0werz