develooper Front page | perl.perl5.porters | Postings from March 2012

Re: [perl #111794] goto ""; behaves like exit (only if argument isconstant empty string)

Thread Previous
From:
Nicholas Clark
Date:
March 16, 2012 09:43
Subject:
Re: [perl #111794] goto ""; behaves like exit (only if argument isconstant empty string)
Message ID:
20120316164310.GU9069@plum.flirble.org
On Fri, Mar 16, 2012 at 07:43:10AM -0700, Zsban Ambrus wrote:

> For example, the following does not output anything:
> 
>  perl -we 'goto ""; warn "hello";'
> 
> 
> More details.  This seems to happen only if the empty string argument is a
> constant (after optimizations).  The statement behaves like exit in that
> it does not throw an exception eval could catch, but destructors and END
> blocks are still ran.  This error is quite old, it seems to exist since at
> least perl 5.8.something, and is still there in perl 5.14.2 and the latest
> blead.

Seems to exist in perl 5.000.

I don't think Perl 4 allowed goto with a string, so it seems to be a Perl 5
bug. (And as it's in 5.000, not a regression)

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About