Search results for "module:Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap"
Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap - Write map { /$pattern/ } @list instead of map /$pattern/, @list.
The expression forms of "grep" and "map" are awkward and hard to read. Use the block forms instead. @matches = grep /pattern/, @list; #not ok @matches = grep { /pattern/ } @list; #ok @mapped = map transform($_), @list; #not ok @mapped = map { transfo...
PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC
Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval - Write eval { my $foo; bar($foo) } instead of eval "my $foo; bar($foo);".
The string form of "eval" is recompiled every time it is executed, whereas the block form is only compiled once. Also, the string form doesn't give compile-time warnings. eval "print $foo"; # not ok eval {print $foo}; # ok...
PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC
Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep - Write grep { /$pattern/ } @list instead of grep /$pattern/, @list.
The expression forms of "grep" and "map" are awkward and hard to read. Use the block forms instead. @matches = grep /pattern/, @list; #not ok @matches = grep { /pattern/ } @list; #ok @mapped = map transform($_), @list; #not ok @mapped = map { transfo...
PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC
Perl::Critic::Policy::BuiltinFunctions::ProhibitStringySplit - Write split /-/, $string instead of split '-', $string.
The "split" function always interprets the PATTERN argument as a regular expression, even if you specify it as a string. This causes much confusion if the string contains regex metacharacters. So for clarity, always express the PATTERN argument as a ...
PETDANCE/Perl-Critic-1.152 - 17 Oct 2023 04:09:08 UTC