http://qs321.pair.com?node_id=150681

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have an array of regexps quoted in single quotes:    @a = ('hello(\w+)', ...); and I have a scalar value that I want to compare against all the regexps to see if it matches one of them:
$a = "Hello(world)"; $b = shift(@a); if ($a =~ /$b/o) { print "Matched!\n"; }
Never can get it to match.

So then I tried modifying my array as follows:    @a = ('hello\((\w+)\)', ...); And tried again to no avail. Help...

Added code tags - dvergin 2002-03-10