perl for and foreach explained with example

# file:
#   for_foreach.pl
# description:
#   this is the file to test semantic of the for and foreach construct
#
# conclusion:
# 	for is a synonym of foreach
# 	for also support the count type of iteration
#
use strict;

for (101 .. 200) { print; }
foreach (101 .. 200) { print; }
for (my $i = 0; $i < 100; ++$i) { 
	print $i;
}
 

你可能感兴趣的:(perl for and foreach explained with example)