Using eval would just introduces a whole new bag of worms; I don't think it would be the best solution. Fortunately, you can specify the modifiers within the regex. Here are two quick examples.
(?i)abc
(?s-m:^start.*end)
The first turns on case-insensitivity for the entire pattern. The seconds turn on single-line matching and turns off multi-line matching for the part of the pattern within the parentheses.
perlre explains this syntax in more detail. |