in reply to /ee regex modifier

The first /e evals $1 into $foo, and the second one evals $foo into 'switch'. Apparently, /e gets the second half of the s/// before any variable expansion takes place.

So if the substitution contains nothing but a single variable, then there'll be no difference between s/// and s///e; the /e expands it, returns it, and that's all.

-- Frag.
--
"Just remember what ol' Jack Burton does when the earth quakes, the poison arrows fall from the sky, and the pillars of Heaven shake. Yeah, Jack Burton just looks that big old storm right in the eye and says, "Give me your best shot. I can take it."

Replies are listed 'Best First'.
Re: Re: /ee regex modifier
by blakem (Monsignor) on Nov 14, 2001 at 06:42 UTC
    Apparently it is behaving like that. I don't understand why the first eval is being passed a '$1' instead of a "$1" though. What happened to "The right hand side of a s/// is a double quoted string"? If /e is an exception, are there any other exceptionis? I haven't been able to find this quirk noted in perlre or perlop.

    Update: The original code has a vestigial 'no strict refs' which has no bearing on the code following it. (its left over from the symref suggestion for expanding global vars)

    -Blake q

      I'd call it a bug, unless of course it's just poetry mode in action. But that would be a bug too, becuase you have struct 'subs' in effect. OK, it's a bug.

          -- Chip Salzenberg, Free-Floating Agent of Chaos

        A bug as in "too bad perl implemented it that way" or as in "time to dig into regcomp.c and whip out perlbug." Would you categorize it as a real bug that needs fixing or a just quirk of the language?

        -Blake