my $modifiers = 'i'; my $text = 'abc'; if ( $text =~ m/$pattern/$modifiers) { print "it matches\n"; }