So, I must ask, what does this do:
> sub foo() {
> return my $self = {
> print "Block";
> return $self;
> }
> }
> my $block = foo;
# = sub {print "Block"; return $self;}
A6:
One obvious difference is that the sub on closures is now optional,
since every brace-delimited block is now essentially a closure. You
can still put the sub if you like. But it is only required if the
block would otherwise be construed as a hash value; that is, if it
appears to contain a list of pairs.
> print "Main";
> $block();
> print "End";
>That is, the block returns from a function that's not currently
>executing.
Main
Block
End
is my guess.
/Stefan