# fail (no parens in regex assignment) perl -wMstrict -E 'my $x="Faith"; my $r=q{?i:faith}; say "ok" if $x =~ /$r/' Quantifier follows nothing in regex; marked by <-- HERE in m/? <-- HERE i:faith/ at -e line 1. # success perl -wMstrict -E 'my $x="Faith"; my $r=q{(?i:faith)}; say "ok" if $x =~ /$r/' ok