The perl interpreter obviously doesn't like this because it is expecting an operator instead of the scalar $modifiers. Is there a way to do this other than a big if elsif statement that covers all of the various operators that may be in $modifiers? Using qr doesn't work any better to build the expression. Thanks in advance.my $modifiers = 'i'; my $text = 'abc'; if ( $text =~ m/$pattern/$modifiers) { print "it matches\n"; }
In reply to Regular expression modifiers in a scalar by wintermte
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |