NAME

Perl::Critic::Policy::BuiltinFunctions::ProhibitForeach - Prohibit foreach keyword

VERSION

version 0.01

DESCRIPTION

This policy prohibits the use of the foreach keyword in favour of the for keyword.

Apply this policy in your code base for the sake of consistency. There can only be one!

foreach my $foo (1..10) { # not ok
for my $foo (1..10) {     # ok

You may also experience additional benefits including screen space savings, reduced storage, saved bandwidth, reduced carbon emissions, less greenhouse gases, increased muscle mass, improved blood pressure, etc. you may even get a promotion and gain greater charisma.

CONFIGURATION

This policy is not configurable except for the standard options.

SEE ALSO

Perl::Critic

AUTHOR

Dean Hamstead <dean@fragfest.com.au>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2025 by Dean Hamstead.

This is free software, licensed under:

The MIT (X11) License