The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
## name Basic failure
## failures 2
## cut

for $foo ( @list ) {}
foreach $foo ( @list ) {}

#-----------------------------------------------------------------------------

## name Basic passing
## failures 0
## cut

for my $foo ( @list ) {}
foreach my $foo ( @list ) {}

#-----------------------------------------------------------------------------

## name Passing lexicals on loops with labels.
## failures 0
## cut

LABEL: for my $foo ( @list ) {}
ANOTHER_LABEL: foreach my $foo ( @list ) {}

BING: for ( @list ) {}
BANG: foreach ( @list ) {}

#-----------------------------------------------------------------------------

## name Failing lexicals on loops with labels.
## failures 2
## cut

LABEL: for $foo ( @list ) {}
ANOTHER_LABEL: foreach $foo ( @list ) {}

#-----------------------------------------------------------------------------

## name Implicit $_ passes
## failures 0
## cut

for ( @list ) {}
foreach ( @list ) {}

#-----------------------------------------------------------------------------

## name Other compounds
## failures 0
## cut

for ( $i=0; $i<10; $i++ ) {}
while ( $condition ) {}
until ( $condition ) {}

#-----------------------------------------------------------------------------

## name Ignore really, really old Perls. RT #67760
## failures 0
## cut

require 5.003;

foreach $foo ( @list ) {
    bar( $foo );
}


#-----------------------------------------------------------------------------

##############################################################################
#      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic/t/Variables/RequireLexicalLoopIterators.run $
#     $Date: 2011-04-27 17:45:39 -0700 (Wed, 27 Apr 2011) $
#   $Author: wyant $
# $Revision: 4076 $
##############################################################################

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :