develooper Front page | perl.perl5.porters | Postings from January 2017

Re: [perl #113938] sort{goto}

Thread Next
From:
Zefram
Date:
January 23, 2017 00:22
Subject:
Re: [perl #113938] sort{goto}
Message ID:
20170123002153.GD26982@fysh.org
Similar and related:

$ perl -lwe 'sub aaa ($$) { goto FOO; FOO: $_[0] <=> $_[1] } print sort aaa (7, 3, 5, 2)'
Can't "goto" out of a pseudo block at -e line 1.
$ perl -lwe 'sub aaa ($$) { {; goto FOO; FOO: $_[0] <=> $_[1] } } print sort aaa (7, 3, 5, 2)'
2357

The check for exiting a pseudo block is being applied too soon.  It needs
to be postponed until after the check for a goto label at the outermost
layer within the pseudo block.  [perl #113936] has the same cause too.

-zefram

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