in reply to Matching parenthesis in a string
Since ()s are metachars for a regexp, you're actually matching "text1_Right" - which doesn't exist in your example. What you'll have to do is escape the ()s in your string:
@array = ("text1_(Right):662:19990913:662:19990913:1", "text2(Right):8000:20020116:8000:20020116:1", "text3:6800:20021015:6900:20021014:1"); $Symbol= "text1_(Right)"; foreach $item (@array){ if ($item =~ m/\Q$Symbol/i) { print "$item\n"; } }
See perlop for the use of \Q
-- Dan
|
|---|