I'm sorry, but this statement is wrong in too many ways to enumerate here.
Modern Perl refers to simply learning from one's past and eschewing a number of practices that have turned out to be bad. As a few examples (this is *by far* not an exhaustive list):
- programming without strict/warnings
- programming without using cpan (i.e. lots of reimplementation and copy/paste)
- write code that's difficult to read
- using bareword filehandles
- using 2-arg open
Modern Perl instead encourages people to (again, non-exhaustive):
- use strictures and warnings everywhere
- use CPAN as much as possible
- don't reimplement functionality repeatedly
- don't ever copy-paste code
- write tests for everything
- use Devel::Cover, Perl::Critic, Perl::Tidy
- use modern features of perl core (such as 3-arg open, filehandle references), that replace bad practices
:ScalarContext(first)
etc), and 2) I’m not aware of anything similar preexisting. HTH HAND]]>
perl -E 'sub lower { (my @r = map { lc } @_)[0..$#r] } say scalar lower "Jim"'
Yeah its annoying, in fact its my usual answer to "what's your most disliked thing about your favorite language?" that gets asked sometimes
]]>sub listify { @_[0..$#_] }
for that purpose. Then you can say sub lower { listify map { lc } @_ }
.]]>
Or as Damian Conway put it in Perl Best Practices, "Don't be clever."
]]>map
: In scalar context, returns the total number of elements so generated.
perlfunc on grep
: In scalar context, returns the number of times the expression was true.
map { _replace_package_symbols( @$_ ) } @callers ;
would be better written like that:
_replace_package_symbols( @$_ ) for @callers;
In general, using map in void context is a wrong usage of the divertisty of Perl syntax.
(That is not an endorsement for the rest of the post)
]]>