in reply to Regular expression modifiers in a scalar

The problem seems to be that $modifiers is not interpolated in time for the compiled regex to have seen it. This will work,

if ( $text =~ m/(?$modifiers)$pattern/ ) { print "it matches\n"; }
That is a facet of "Cloistered Pattern Modifiers", as covered on p186 of the Camel Book(3ed.).

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Regular expression modifiers in a scalar
by wintermte (Initiate) on Jul 24, 2006 at 12:21 UTC
    I don't know how I missed that section. I swear I paged through that chapter several times looking for the answer. I it is a small section I guess... Thanks again.