NAME
Perl::Critic::PolicyBundle::PERLANCAR::BuiltinFunctions::GrepWithSimpleValue - Warn grep with simple value
VERSION
This document describes version 0.002 of Perl::Critic::PolicyBundle::PERLANCAR::BuiltinFunctions::GrepWithSimpleValue (from Perl distribution Perl-Critic-PolicyBundle-PERLANCAR), released on 2017-08-16.
SYNOPSIS
DESCRIPTION
This policy is written by HAUKEX.
A grep
with a constant value as the last thing in its block will either return all or none of the items in the list (depending on whether the value is true or false). You may have accidentally said grep {123}
when you meant grep {$_==123}
, or grep {"foo"}
when you meant grep {$_ eq "foo"}
or grep {/foo/}
.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Perl-Critic-PolicyBundle-PERLANCAR.
SOURCE
Source repository is at https://github.com/perlancar/perl-Perl-Critic-PolicyBundle-PERLANCAR.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-PolicyBundle-PERLANCAR
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
http://perlmonks.org/?node_id=1196368
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.