develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #20682] [fix] @- array not visible in s///

Thread Previous | Thread Next
Nicholas Clark
February 21, 2003 14:35
Re: [perl #20682] [fix] @- array not visible in s///
Message ID:
On Fri, Feb 21, 2003 at 09:44:28PM +0000, Ton Hospel wrote:
> In article <20030221155014.GB793@ratsnest.hole>,
> 	Enache Adrian <> writes:

> > the warn will be executed, even if the substitution failed.
> > The builtins that do i/o have of course side effects: flagging
> > them with 'd' in could be a solution. That will be
> > only marginally useful, though.
> > 
> A better side-effect detector seems better though. I must admit i've never
> been bitten by it yet, but I sometimes do things like:
> $a[$b{$c} || die "Oops ! no $c in hash"] so I suppose id'd better not 
> combine that to s/.../$a[$b{$c} || die]/
> Personally I'm not a fan of optimizations that are sometimes plain
> incorrect. But flagging side-effect operators  operators and ignoring
> overload and tie fetch seems an acceptable compromise.

Although we could also maintain a global (er, per ithread) count of tied
variables, and whenever it is zero use the current, optimised version.
I suspect that for most programs, most of the time, that would remain a
speed win.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About