develooper Front page | perl.perl6.language | Postings from April 2006

Re: [svn:perl6-synopsis] r8637 - doc/trunk/design/syn

Thread Previous
Larry Wall
April 10, 2006 19:38
Re: [svn:perl6-synopsis] r8637 - doc/trunk/design/syn
Message ID:
On Mon, Apr 10, 2006 at 10:32:33PM -0400, Joe Gottman wrote:
:    How does the "sub" keyword fit in here?  Is there any difference between
: the lines
: 	return {say "Hello World";};
: and 
: 	return sub {say "Hello World";};
: ?

Effectively, no, for these examples.  In the second case you could
omit the "return" since you're not returning a bare block, so it's
not ambiguous.  (The other difference is that the explicit sub form
allows you to return from within the closure.)


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