Re: [Perl/perl5] 502da7: make /p a no-op

[email protected] (demerphq)
Newsgroups perl.perl5.porters
Message-ID <CANgJU+UoN-+Z8oBmhf=Mq_JgB2OUsqntV3XoXo8w17yJR+PxbQ@mail.gmail.com>
On my phone so forgive the double reply. The code i mean is something like
this:

while (<>) {
  while (/(.)/g) { $count++}
}

Try that on a large file. If it appears to hang then /p should not be
removed.

Yves

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

On Thu, 12 Feb 2026, 17:56 demerphq, <[email protected]> wrote:

> You sure this doesn't make while /g matches go quadratic? Lastly I checked
> /p still matters for while/g -- the COW stuff doesn't always kick in: Not
> every string can be COWed. Iirc strings returned from <>/readline aren't
> COWed.
>
> Every time people proposed removing /p when I have  checked while /g it
> has been broken.
>
> Yves
>
> Yves
>
> ---
> perl -Mre=debug -e "/just|another|perl|hacker/"
>
> On Thu, 12 Feb 2026, 16:39 Philippe Bruhat (BooK) via perl5-changes, <
> [email protected]> wrote:
>
>>   Branch: refs/heads/book/p-modifier-is-a-noop
>>   Home:   https://github.com/Perl/perl5
>>   Commit: 502da7e0422c94f36fda5e70416c4f92adca225e
>>
>> https://github.com/Perl/perl5/commit/502da7e0422c94f36fda5e70416c4f92adca225e
>>   Author: Philippe Bruhat (BooK) <[email protected]>
>>   Date:   2026-02-12 (Thu, 12 Feb 2026)
>>
>>   Changed paths:
>>     M regexec.c
>>     M t/re/reg_pmod.t
>>
>>   Log Message:
>>   -----------
>>   make /p a no-op
>>
>> meaning that a copy of the matched string is always preserved,
>> regardless of usage of the /p modifier
>>
>> Closes GH #24147
>>
>>
>>   Commit: 38f00a1fb6754d42ee8282106fa99bf51defc263
>>
>> https://github.com/Perl/perl5/commit/38f00a1fb6754d42ee8282106fa99bf51defc263
>>   Author: Philippe Bruhat (BooK) <[email protected]>
>>   Date:   2026-02-12 (Thu, 12 Feb 2026)
>>
>>   Changed paths:
>>     M pod/perlreref.pod
>>     M pod/perlvar.pod
>>
>>   Log Message:
>>   -----------
>>   document the new behaviour of /p
>>
>>
>>   Commit: 432b96a3328e773407f8c31a9fd224b3b0606f1a
>>
>> https://github.com/Perl/perl5/commit/432b96a3328e773407f8c31a9fd224b3b0606f1a
>>   Author: Philippe Bruhat (BooK) <[email protected]>
>>   Date:   2026-02-12 (Thu, 12 Feb 2026)
>>
>>   Changed paths:
>>     M pod/perldelta.pod
>>
>>   Log Message:
>>   -----------
>>   perldelta entry about the neutering of /p
>>
>>
>> Compare:
>> https://github.com/Perl/perl5/compare/bc4893f14393...432b96a3328e
>>
>> To unsubscribe from these emails, change your notification settings at
>> https://github.com/Perl/perl5/settings/notifications
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.