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

Re: [perl #54728] PathTools-3.27 triggers a bug in Perl

Thread Previous | Thread Next
From:
Ed Avis
Date:
August 20, 2013 10:20
Subject:
Re: [perl #54728] PathTools-3.27 triggers a bug in Perl
Message ID:
loom.20130820T121648-706@post.gmane.org
Dave Mitchell <davem <at> iabyn.com> writes:

>>But at present $1 exists in a strange halfway house where it is neither
>>truly global nor truly local.

You are right to note that $. and other punctuation variables have the
same behaviour.

I suggested that $1 should be 'localized properly' but you noted that this
might involve quite a performance penalty for every regexp match.

A simpler answer, I suggest, is that when variables like $1 and $. are passed
as arguments to subroutines, a copy be made in a read-only temporary scalar.
That would get rid of these perennial bug reports or surprises.  How about it?

-- 
Ed Avis <eda@waniasset.com>






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