PS: I saw that Dave suggested: > If the R::G's overload method were to return a qr// containing the > string plus code, rather than returning a string, then things should > Just Work (tm). Indeed. Except, as explained in my previous post, the overload method can't just build and return a qr// each time its invoked, because: (a) it needs access to the entire contents of the original regex including the contents of interpolated variables (so it needs to use the return-an-object-that-accumulates-concatenations technique), and (b) even if it didn't need to accumulate interpolations, any code blocks in the original regex wouldn't then close over the correct variables, having been qr'd in the lexical scope of the overload sub, rather than the lexical scope of the original regex. DamianThread Previous | Thread Next