in reply to eval routines for faster regexp: how-to...
2/ you code is basically:
sub { return 1 if m!foo!o; return 0 }
this can be simplified to
sub { m!foo!o }
Not only this returns a boolean value but at no extra cost the list of strings matched in parenthesis if there are like the rest of your post implies. In that later case, the boolean value is obtained indirectly because in scalar context, the list is converted to its length. This leads me to 3/
3/ now about $match = qq@ return (\$1,\$2) if m!(foo)(bar)!; @; As I said the match operator returns directly the list of matches so you don't need to return explicitely $1, $2...
I really don't understand what you want to do. But I am sure your way of doing it is certainly incorrect.
Edited: suppressed inaccurate remarks. Thanks to chipmunk for pointing out my mistakes.
-- stefp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: eval routines for faster regexp: how-to...
by chipmunk (Parson) on Nov 08, 2001 at 08:40 UTC | |
by pike (Monk) on Nov 08, 2001 at 14:27 UTC | |
by Fletch (Bishop) on Nov 08, 2001 at 18:47 UTC |