develooper Front page | perl.perl5.porters | Postings from November 2011

Re: Explanation of "for" and "foreach" in perldoc

Thread Previous | Thread Next
From:
Eric Brine
Date:
November 29, 2011 09:26
Subject:
Re: Explanation of "for" and "foreach" in perldoc
Message ID:
CALJW-qE0PDcLt9EieJQfuU3EJq6-rdqby7SQ6KeBtAjoU90daw@mail.gmail.com
On Tue, Nov 29, 2011 at 3:53 AM, Christian Walde <
walde.christian@googlemail.com> wrote:

> On Tue, 29 Nov 2011 09:47:55 +0100, Eric Brine <ikegami@adaelis.com>
> wrote:
>
Why do people always leave out C<< for (EXPR..EXPR) >> when discussing
>>
> preferences for "for" vs "foreach"?
>>
>
> Because .. does result into an array?


Nope, it doesn't into an foreach loop iterating over an array or list*. It
results into a counting loop.

* -- Except for C<< for (CONST..CONST) >> which expands into an array at
compile-time, IIRC

- Eric


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About