On 4/20/07, oryann9 <[EMAIL PROTECTED]> wrote:
snip
So will foreach really be going away?
snip

If Synopsis 4* is to be believed, in Perl 6 there will not be a loop
named foreach.  There will be a loop named for that does the has all
of the functionality of foreach (just like in Perl 5).  Also the for
loop will not have the C-style functionality.  A new loop named loop
will have that functionality.

So the Perl 5 code

foreach my $elem (@array) {}
for (my $i = 0; $i < 10; $i += 3) {}

will in Perl 6 become

for @array -> $elem {}
loop ($i = 0; $i < 10; $i += 3) {}

Note that the loop construct could also be written like this

for 0 .. 10 : by 3 -> $i {}

I am not aware of any targeted release date for Perl 6 (other than
"when it is done"), so you still have plenty of time with foreach to
say your goodbyes, but I would note that many things from Perl 6 are
coming early in perl 5.10: say, given/when, // (like ||, but tests for
undef, not false), err (like or, but tests for undef not false), and
~~ (replaces and extends =~).

* http://dev.perl.org/perl6/doc/design/syn/S04.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to