|
|
|
|
|
by jerf
4778 days ago
|
|
Can someone explain the point of the lexical subroutines? [1] In particular, I'm lost on the difference between sub outer {
my $closurevar;
my $inner = sub {
... use $closurevar...
};
}
and sub outer {
my $closurevar;
my sub inner {
... use $closurevar...
}
}
(I mean this as an honest question. That said, I do hope that I'm missing something and this is more than just a syntax gloss.)[1]: http://search.cpan.org/~rjbs/perl-5.18.0/pod/perlsub.pod#Lex... |
|
Oh, and I guess lexical subs can have prototypes, which were ignored when calling a coderef with `&` or `->()`. This allows to create really nice, but properly scoped pseudosyntax.