in reply to a word of warning about /$pattern/
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: a word of warning about /$pattern/
by zby (Vicar) on Dec 02, 2003 at 15:43 UTC |