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

Re: Changes in m//m in 5.10

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
December 19, 2007 14:07
Subject:
Re: Changes in m//m in 5.10
Message ID:
20071219220647.GA35087@penkwe.pair.com
On Wed, Dec 19, 2007 at 10:26:51PM +0100, Rafael Garcia-Suarez wrote:
> On 19/12/2007, Andy Lester <andy@petdance.com> wrote:
> > Can someone explain why this is so?
> >
> > $ cat test.pl
> > my $buffer = qq{blah\nfoo\nblah};
> > my $regex = qr/^foo/;
> > print "Running $], ", $buffer =~ /$regex/m ? 'found' : 'not found',
> > "\n";
> >
> > $ perl test.pl
> > Running 5.008008, found
> >
> > $ perl510 test.pl
> > Running 5.010000, not found
> >
> > ack fails its tests because of this behavior, which is what led me
> > down this path.
> 
> 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.

But in Andy's example, it is not affecting the regex it was applied to.

That bug report was for /m propagating to a regex used in a subroutine
called from the replacement part of a substitution, which seems to be a
completely different situation.

Ronald

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