in reply to Difference between for and foreach

There are two types of for loop in Perl, the C-style one

for ($x = 1; $x <= 10; $x ++) { ... }

and the other sort

for $x ( 1 .. 10 ) { ... }

Both can be written with foreach instead of for as the former is just a synonym for the latter. See the sections on loops in perlsyn.

Cheers,

JohnGG