in reply to Re: Naked quotes work like m//?
in thread Naked quotes work like m//?

A bit confused here. The string "(\\.)" isn't the same as the regexen in the other two examples. Because stringification removes a level of backslashes, so the regex applied in the second example is really (\.) which is, of course, very different from (\\.)

I think the backslash obscures the issue a lot, though, so I added another test without any backslashes: $s =~ "(a.c)" and print $1;

It produced abc which seems to me to indicate that the string is actually being evaluated as a regex. And I think you're saying that this isn't the case.

So what am I missing? Or misinterpreting?

Replies are listed 'Best First'.
Re^3: Naked quotes work like m//?
by bart (Canon) on Dec 05, 2004 at 19:21 UTC
    What you're missing is that the value of the string is interpreted as the regex, and not how you write the source code for the string. So a double backslash in the source code is actually just a single backslash in the string, and in the regex; and 4 backslashes in the source code is actually a double backslash in both string and regex.
      No, I understood that part. I just thought that you were saying that a string isn't applied like a regex at all -- so it seems that this is what I misinterpreted. Thanks for the explanation.