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

Re: [perl #24250] "return" required in some anonymous closures

Dave Mitchell
October 20, 2003 06:15
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
On Mon, Oct 20, 2003 at 08:58:05AM -0400, Mark Jason Dominus wrote:
> Dave Mitchell <>:
> > This isn't a bug, it's a feature :-)
> > 
> > sub () {$lexical} is a constant sub generator, ie each call to 'sub'
> > returns a new constant sub rather than a closure. 
> Oh well, so much for the principle of least astonishment.
> What's the workaround for this feature?

Remove the ()'s.

To collect all the latest movies, simply place an unprotected ftp server
on the Internet, and wait for the disk to fill.... Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About