develooper Front page | perl.perl5.porters | Postings from August 2010

Re: [PATCH] Re: [perl #19078] wrong match order inside replacement

Thread Previous | Thread Next
From:
demerphq
Date:
August 4, 2010 03:27
Subject:
Re: [PATCH] Re: [perl #19078] wrong match order inside replacement
Message ID:
AANLkTinSJgCSOtn4dgw9+WcuQjbyuNaDLVdJmjKga46n@mail.gmail.com
On 1 August 2010 21:19, Father Chrysostomos <sprout@cpan.org> wrote:
> A slightly simpler case:
>
> $ perl -le '$_="CCCGGG"; s!.!@a{print("[$&]"),/./}!g'
> [C]
> [C]
> [C]
> [C]
> [C]
> [C]
>
> What’s happening is that the s/// does not reset PL_curpm for each iteration, because it doesn’t usually have to.
>
> The RHS’s scoping takes care of it most of the time. This happens with the /e modifier and with @{...}.
>
> In this example, though, we have a subscript, not a block. This subscript is in the same scope as the s/// itself.
>
> The assumption that the substitution operator will never have to reset PL_curpm itself appears to be incorrect. The attached patch fixes it.

Hi, thanks for the patch. Im a little concerned that this might have
deeper consequences than at first meet the eye, could we hold off on
this one until we know more?

Yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About