in reply to Re: for vs foreach
in thread for vs foreach

The words for and foreach have always been interchangable back to Perl version 0.

But for purposes of documentation, we call a for loop the thing that acts very C-like (with three expressions separated by semicolons), and foreach is reserved for the csh-like thing (with a variable to walk through a list).

In my experience, people start out writing a lot of for-loops, but end up writing many more foreach loops. Of course, people spell it "f-o-r" and pronounce it "foreach".

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: Re: for vs foreach
by c-era (Curate) on Jul 14, 2000 at 18:38 UTC
    Thanks for the info. I probably didn't realize they were then same until perl 5 came out.