in reply to Re^7: Interview Prepration
in thread Interview Prepration

Can we both agree on this:

In Perl, the keywords "for" and "foreach" are identical. In many other languages, the two words stand for two different kinds of loops

No, only if you change that to "many languages, including Perl".

perlsyn has a heading called "for loops", and a heading called "foreach loops". I'm going to quote that as an authority, as it was written by the only authority who really matters. Therefore, Perl has for loops, and foreach loops, and overlapping keywords. "for" and "foreach" are not the same in that sentence.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^9: Interview Prepration
by jZed (Prior) on Apr 04, 2005 at 18:51 UTC
    Ok, how about:

    In Perl, the keywords "for" and "foreach" are identical. In many other languages the two keywords refer to two different loop structures. Perl supports both loop structures, but allows the use of either keyword for either structure.

      Many other languages? Could you name a few that actually have the keywords 'for' and 'foreach', and refer to two different loop structures?
        ferite
        C#
        TCL
        PHP

        Not sure how different they are... I'm just being argumentative of course :)
        --------------
        "But what of all those sweet words you spoke in private?"
        "Oh that's just what we call pillow talk, baby, that's all."