in reply to Re: special characters in regexp
in thread special characters in regexp
But if we're nitpicking, if you shouldn't use a construct just because in some cases, this fails, you made a bigger boo-boo than the op with his $a and $b. You're trying to use $@ as an indication whether an eval failed or not. That's wrong; an eval may fail while $@ is false due to cleanup actions. The only way to be sure an eval succeeded is to check its return value:
eval { $matched = $contender =~ /$regexPattern/; 1; } or warn $@ // "Unknown error";
|
|---|