in reply to Re: Regex Help
in thread Regex Help

Hmm ... now I'm confused. The original post had $CONFIG{DYNAMIX_OUTBURST} without any escapes, leading me to believe that the value of $CONFIG{DYNAMIX_OUTBURST} was wanted in the file. But the followup to my post by the OP had it backwhacked, and so does this one.

Do we want the value, or do we want the literal string?

-dlc

Replies are listed 'Best First'.
RE: RE: Re: Regex Help
by tye (Sage) on Sep 23, 2000 at 07:12 UTC

    You have to escape the dollar sign to protect it from the shell.

    It just occurred to me that this is a case where s/// and s///e do exactly the same thing.

            - tye (but my friends call me "Tye")
      In the original post, he didn't escape the `$' in the replacement at all. But the post I responded to did backwhack it, and that code was in a file, so there was no shell involved. Moreover, in the OP's second post, he backwhacked it 3 times, to get a backslash all the way through the shell into Perl, which would make the replacement not interpolate. There's a discrepancy between the original post and those two posts wrt what behavior is wanted.

      You're right that this is a case where the /e modifier doesn't matter.

RE: RE: Re: Regex Help
by meonkeys (Chaplain) on Sep 24, 2000 at 23:19 UTC
    dchetlin said:
    Do we want the value, or do we want the literal string?
    and
    There's a discrepancy between the original post and those two posts wrt what behavior is wanted.

    Well, you ask excellent questions! I should have stated more clearly what I wanted. I wanted to replace this (literally)
    <% $flat->purge('dynamix','outburst') %>

    with this (literally)
    $CONFIG{DYNAMIX_OUTBURST}

    Sorry for the confusion. I didn't escape $CONFIG{DYNAMIX_OUTBURST} in the regex because I didn't know that it would be interpolated when using single quotes for the string that Perl will execute. I am curious as to the function of each individual backwhack.