in reply to match with symbol

Did you mean:
print "yes\n" if ($var1 eq $var);
?
Your regexp doesn't match because '+' has a special meaning there. You should use:
$var='/Sample \+ Design';

Replies are listed 'Best First'.
Re^2: match with symbol
by Anonymous Monk on Jul 22, 2009 at 12:33 UTC
    Hey as said earlier in patternmatch the special character has different meaning, so we need to put backslash infront of those chars. $var = '/Sample + Design'; $var1 = '\/Sample \+ Design'; if($var =~/$var1/) { print "yes \n"; } else{ print " No \n"; } Thanks claiming