Shouldn't you anchor it, e.g.:
my $pattern = qr//; $_ = 'foo'; /\A \Q$pattern\E \z/x and print "Matched\n";
Then you don't have to worry about an empty pattern at all. You also don't have to worry about only part of the string matching the pattern.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: a word of warning about /$pattern/
by hardburn
in thread a word of warning about /$pattern/
by dada
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |