$text="I have a problem with pre-compiled regex"; @words=qw(qr/have/ qr/regex/); for $a(@words) { while ($text =~ /$a/g) { print "Found $&\n"; } }