... any $string can be used as a valid regex like in m/$string/ ...
... and you don't even need the m// or qr// incantation. The =~ binding operator can do the trick:
>perl -wMstrict -le "my $s = 'abc'; ;; print 'match' if 'xabcx' =~ $s; print 'match' if 'xabcx' =~ 'abc'; " match match
In reply to Re^2: Detecting if a string is a regular expression
by AnomalousMonk
in thread Detecting if a string is a regular expression
by smontsar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |