Steve Peters wrote:
> To help others in avoiding the same embarassing moment I had last
> week, below is a patch to help to help clarify the actual
> functionality of for and foreach.  I'm also working on a slightly
> larger patch to merge the "For loop" and "Foreach loop" sections
> of the documentation to help emphasize the fact that there is
> no difference in the functionality of the two.

OK, not yet applied because I'm waiting for the other patch, and
I'll point out that "for" and "foreach" are the same token as far
as perl 5's lexer and parser are concerned.

Perhaps just say that "foreach" is accepted as an alias for "for",
and keep "for" as the main form. Just to prepare the path for perl 6 :)

> --- perlsyn.pod.old     Mon Jun 20 08:42:00 2005
> +++ perlsyn.pod Mon Jun 20 08:43:53 2005
> @@ -200,6 +200,9 @@
>      LABEL while (EXPR) BLOCK
>      LABEL while (EXPR) BLOCK continue BLOCK
>      LABEL for (EXPR; EXPR; EXPR) BLOCK
> +    LABEL for VAR (LIST) BLOCK
> +    LABEL for VAR (LIST) BLOCK continue BLOCK
> +    LABEL foreach (EXPR; EXPR; EXPR) BLOCK
>      LABEL foreach VAR (LIST) BLOCK
>      LABEL foreach VAR (LIST) BLOCK continue BLOCK
>      LABEL BLOCK continue BLOCK
> 

Reply via email to