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
|
---|
Replies are listed 'Best First'. | |
---|---|
(ar0n) Re: Need help comparing against a set of regexps
by ar0n (Priest) on Mar 10, 2002 at 07:11 UTC | |
by Anonymous Monk on Mar 10, 2002 at 07:22 UTC | |
by ar0n (Priest) on Mar 10, 2002 at 07:40 UTC | |
Re: Need help comparing against a set of regexps
by seattlejohn (Deacon) on Mar 10, 2002 at 08:09 UTC | |
Re: Need help comparing against a set of regexps
by gellyfish (Monsignor) on Mar 10, 2002 at 10:13 UTC | |
Re: Need help comparing against a set of regexps
by Juerd (Abbot) on Mar 10, 2002 at 12:34 UTC | |
Re: Need help comparing against a set of regexps
by strat (Canon) on Mar 10, 2002 at 21:41 UTC |
Back to
Seekers of Perl Wisdom