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 |