If you are interpolating a string it does not matter if it has characters that are the same as the delimiter. The boundaries of the regex are determined before the interpolation is done. Try this:if ($_ = m%$dm%) { #stuff }
perl -e '$string = "/"; print "08/14/04"=~/$string/ ? "matched\n" : "no match\n"'
In reply to Re^2: regex match with interpolated pattern
by fletcher_the_dog
in thread regex match with interpolated pattern
by drock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |