Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The following code produces this error:
Unmatched ( in regex; marked by <-- HERE in m/Hi( <-- HERE / at match_problem.pl line 14
But only if $str1 or $str2 have an upper case letter! No problem if both are lower case. Also, no problem with punctuation marks other than parentheses.
Very strange; any insight will be highly appreciated.
I'm only moderately knowledgeable; would appreciate as simply-stated an answer is possible.
Here is the code:
$str1 = "Hi("; $str2 = "hi"; if ($str2 =~ $str1) { print "Match: Yes\n"; } else { print "Match: No\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Possible Match Problem
by ww (Archbishop) on Jan 18, 2012 at 23:03 UTC | |
Re: Possible Match Problem
by toolic (Bishop) on Jan 18, 2012 at 22:42 UTC | |
Re: Possible Match Problem
by Marshall (Canon) on Jan 18, 2012 at 23:39 UTC | |
by AnomalousMonk (Archbishop) on Jan 19, 2012 at 06:05 UTC | |
by Marshall (Canon) on Jan 19, 2012 at 08:30 UTC | |
by AnomalousMonk (Archbishop) on Jan 19, 2012 at 16:07 UTC | |
Re: Possible Match Problem
by Anonymous Monk on Jan 18, 2012 at 23:20 UTC |
Back to
Seekers of Perl Wisdom