in reply to qr// with /e?
qr//, builds up the RE that can be used on s/this side// of the s/// operator. Thus, just as /e has no relevance to m//, it has no relevance to qr//, nor to s/this side//.
perlretut discusses this briefly: "A modifier available specifically to search and replace is the s///e evaluation modifier. s///e wraps an eval{...} around the replacement string and the evaluated result is substituted for the matched substring. s///e is useful if you need to do a bit of computation in the process of replacing text."
You're talking, it seems, about allowing the actual RE portion to be eval{...}'ed prior to the execution of the RE. That is going to be a tough sell and my suspician is that it's going to be nearly impossible to implement correctly. After all, if you eval m/$var+1/ prior to using it as a regexp, is it "$var plus one", or is it "$var repeated one or more times, followed by a 1 character"? And should $var be interpolated prior to the eval, or after the eval but prior to the execution of the RE? Things are tricky enough when it comes to getting it right with the quoted version of eval. Imagine trying to deal with the affects of the RE quote-like operator on top of your eval!
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: qr// with /e?
by tkil (Monk) on Apr 24, 2004 at 23:37 UTC | |
by davido (Cardinal) on Apr 25, 2004 at 00:01 UTC | |
by tkil (Monk) on Apr 25, 2004 at 00:37 UTC |