in reply to difference between for and foreach?

The words for and foreach are interchangable, syntactically. (This is what most people are saying when they say there's "no difference").

However, as Larry intended it, there's a "for" statement, with 3 parts, like C's same-named, and a "foreach" statement, like csh's same-named loop. And they do nicely different things, even though they're both basically loops.

So, yes, there's a difference, except when there's not a difference. If you check the Llama, we're very careful to describe the two kinds of loops seperately. They have different uses and syntax.

-- Randal L. Schwartz, Perl hacker

  • Comment on Re: difference between for and foreach?