$ perldoc perlintro | grep foreach the more friendly list scanning "foreach" loop. foreach foreach (@array) { print $list[$_] foreach 0 .. $max; foreach my $key (keys %hash) { $ perldoc perlsyn | grep foreach foreach LIST The "foreach" modifier is an iterator: it executes the statement once print "Hello $_!\n" foreach qw(world Dolly nurse); LABEL foreach VAR (LIST) BLOCK LABEL foreach VAR (LIST) BLOCK continue BLOCK The "foreach" loop iterates over a normal list value and sets the loop. This implicit localization occurs *only* in a "foreach" loop. The "foreach" keyword is actually a synonym for the "for" keyword, so you can use "foreach" for readability or "for" for brevity. (Or because "foreach" loop index variable is an implicit alias for each item in the If any part of LIST is an array, "foreach" will get very confused if you "foreach" probably won't do what you expect if VAR is a tied or other foreach $item (split(/:[\\\n:]*/, $ENV{TERMCAP})) { Perl executes a "foreach" statement more rapidly than it would the Instead of using "given()", you can use a "foreach()" loop. For example, requires initialization, such as a subroutine or a "foreach" loop. It