in reply to How to apply modifiers to a substitution via variable?

Something like my $reg = qr{(?$modifiers:$regular)} would probably work...

my $string = "aaaaaaaaa"; $modifiers = "g"; $string =~ s/(?$modifiers:a)/b/; # ?? print $string;

Although, the more I think about it... I don't think /g in there. /i does.

For that second question, though, I think you'll have to eval like the post above.

-Paul