The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Search results for "module:Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap"

Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap - Write map { /$pattern/ } @list instead of map /$pattern/, @list. River stage three • 133 direct dependents • 408 total dependents

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);". River stage three • 133 direct dependents • 408 total dependents

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. River stage three • 133 direct dependents • 408 total dependents

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. River stage three • 133 direct dependents • 408 total dependents

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
4 results (0.119 seconds)