develooper Front page | perl.perl5.porters | Postings from December 2007

Re: Changes in m//m in 5.10

Thread Previous | Thread Next
From:
demerphq
Date:
December 19, 2007 14:11
Subject:
Re: Changes in m//m in 5.10
Message ID:
9b18b3110712191410l6eb7e5fdqffe7442595aa580d@mail.gmail.com
On 19/12/2007, Andy Lester <andy@petdance.com> wrote:
>
> On Dec 19, 2007, at 3:26 PM, Rafael Garcia-Suarez wrote:
>
> > The effect of /m is no longer global, but it now only affects the
> > regexp it was applied to. No more unwanted side effects! See bug
> > http://rt.perl.org/rt3/Ticket/Display.html?id=22354
> > Incidentally, that was to fix this bug that $* was removed.
>
>
> So really, all this time the /m should have gone on the qr//, not on
> the m/$regex/ ?

Yes. Although it wasnt clear to me straight away. :-)

Although, IMO its an arguable case slightly in this case due to there
not being anything else in the pattern. If there was anything else
involved in the pattern then the situation would be clear that 5.10 is
correct. With the bare pattern however its arguable that we could
check the modifiers on the m// and see if they match that of $regex
and recompile if not. This would be DWIM but would also negate most of
the point of using qr//.

Probably it would be better to simply warn "Useless use of modifiers
on m/// at line ...".

cheers,
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