\Q quote (disable) pattern metacharacters till \E
look at this code:
$comm = '(xyz'; $line = '123(xyz)456'; if ($line =~ /$comm/) { #error! same as $line =~ /(xyz/ which ha +s an unmatched '(' # do stuff } if ($line =~ /\Q$comm/) { #no error! same as $line =~ /\(xyz/ -- ' +(' is escaped # do stuff }
--
flounder
In reply to Re^3:: Regex ERROR!
by flounder99
in thread Regex ERROR!
by nofernandes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |