On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote:
> I know they are both the same, I just want to know why we have both.
snip

Because originally they meant different things.  The for loop was a
c-style loop and the foreach loop was an iterator.  Eventually it was
realized that the iterator style was a better loop and typing foreach
every time was annoying, so they made for able to do both types of
loops.  In order to keep as much code running as possible the foreach
loop was kept.  Just ignore foreach.

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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


Reply via email to