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:
Never can get it to match.$a = "Hello(world)"; $b = shift(@a); if ($a =~ /$b/o) { print "Matched!\n"; }
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
Back to
Seekers of Perl Wisdom