
gregaiken
New User
Jun 6, 2008, 3:43 PM
Post #3 of 5
(2646 views)
|
|
Re: [KevinR] eval { $dynamic_pattern_match }; doesnt work with activeperl...
[In reply to]
|
Can't Post
|
|
to answer you... in all of the perl regex code ive ever written or seen contributed by others, ive, until now, not seen the form you present, where a scalar is seen as a part of the regex (/$var/). with my limited knowledge, i had assumed i needed to somehow create the regex command in a form where the variable substitution was previously done. hence my attempt to build a regex command (using \x## for special characters) then evaling it. your approach is so simple, that i never would have guessed it could have worked. by the way, at a different perl mailing list, another perl guru found the reason my code did not work, as initially written, was becaues a few variables needed to be predeclared by the use of 'my'. by declaring the variables i used, my code magically worked. thank you much for the simple elegance of your suggestion.
|