
demerphq at gmail
Jun 5, 2012, 6:01 AM
Post #8 of 8
(114 views)
Permalink
|
|
Re: [perl #113094] [perl #21491] : Keeping track of 'Unescaped left brace in regex is deprecated'
[In reply to]
|
|
On 5 June 2012 14:26, Ricardo Signes <perl.p5p [at] rjbs> wrote: > * demerphq <demerphq [at] gmail> [2012-06-05T02:12:29] >> On 1 June 2012 23:40, Karl Williamson <public [at] khwilliamson> wrote: >> > >> > Bug #21491 says that single quotes should not interpolate. But this code >> > assumes that it does. If we fixed #21491, I believe it would break this >> > code, would it not? >> >> Are you sure about that? I don't see any interpolation there. Do you >> mean escape handling? >> >> As far as I understand things \\ and \' are *supposed* to be unescaped >> inside m''. >> >> So what do you mean by this? I see nothing unexpected here. > > I was confused by this, too, and foolishly didn't go read 21491. This is about > escape sequences, not variable interpolation. I was rushing through my mail > queue and not verifying everything I read. I'm sorry if this lead to spreading > any confusion! Arent the case that Karl mentioned and the case in the bug different? The case in the bug comes down to this: my $pat= "\\n"; print "\n"=~/$pat/; Which matches, because the toker first turns "\\n" into "\n" and then hands it to the regex engine which turns the "\n" into a literal $n. This behaviour has changed over time and the docs should probably explain that \n IS a regex escape sequence just like \w, which "happens" to match the same thing that "\n" is unescaped into. > Yes, fixing this looks like it would break the world. In fact, I think the > busted thing is likely the documentation, although it looks like it needs a > careful read before I really state that with confidence. Well, I can argue the case of: $x="\\n"; "\n"=~/$x/, but the case of "\n"=~m'\\n' is a lot easier to say is a bug. Even if neither is entirely clear. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"
|