Can someone explain the point of the lexical subroutines? [1]<p>In particular, I'm lost on the difference between<p><pre><code> sub outer {
my $closurevar;
my $inner = sub {
... use $closurevar...
};
}
</code></pre>
and<p><pre><code> sub outer {
my $closurevar;
my sub inner {
... use $closurevar...
}
}
</code></pre>
(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.)<p>[1]: <a href="http://search.cpan.org/~rjbs/perl-5.18.0/pod/perlsub.pod#Lexical_Subroutines" rel="nofollow">http://search.cpan.org/~rjbs/perl-5.18.0/pod/perlsub.pod#Lex...</a>
The dynamic scoping in Perl seems a bit troublesome to me. Maybe even a security issue. Can you prevent functions you call from accessing variables in your scope? Do you have to somehow sanitize your scope if this is an issue? Seems a little bit worrying. With the exception of closures inside nested functions, I wish functions just had their own scope and if you want them to have anything else, just pass it in.
I understand why smartmatch is labeled experimental, but what's the "modern Perl" replacement for given/when? I only use it as a stupid switch statement but I don't want it breaking with Perl 5.22 either...
I was a Perl lover once.<p>And now it seems I understand the haters.<p><i>Just don't use Perl</i>.<p>The language seems fine, productive, even sublime at first but you will encounter some horrible design features.<p>Just read the following,<p><a href="http://markmail.org/message/h2spyi5za4qheuft" rel="nofollow">http://markmail.org/message/h2spyi5za4qheuft</a><p>-- Perl's data structure serialization is leaky. Thought you made an int ? Whoa ... serialized as a string.<p><a href="http://blogs.perl.org/users/rurban/2013/02/no-indirect-considered-harmful.html#comment-370624" rel="nofollow">http://blogs.perl.org/users/rurban/2013/02/no-indirect-consi...</a><p>-- A language feature causing a burnout ? Well fuck me !<p>That's just a tip of the iceberg.<p>PHP, a fractal of bad design ?<p>Perl, a quantum bomb, waiting to tick off.<p>The Modern Perl movement is like saying "I'll close my eyes and crime ceases to exist."<p>No best practices will save you from broken language features.<p>The people who maintain Perl source code, are not a _<i>fan</i>_ of Modern Perl. They won't make "strict" the default or introduce signatures or better OOmodel.<p>The people who proclaim "Modern Perl" won't fork.<p>Even this release shows how clueless Perl maintainers are !<p>* They released a switch statement long long back<p>* And now they mark it even as "experimental" because of the leaky "my $_" scope.<p>Oh God ! I will never emotionally invest in another tool.<p>EDIT: Neutral language.