My personal convention is to write counting loops and C-style loops using for, and iterating loops using foreach. That way, the extra cost of flattening the list is not hidden. However, Perl will gladly accept both for and foreach in every case.

And many people share your pov, while I'm of the "three chars are easier to type no matter what" school of thought - I also think we've "argued" about these issues in the past, but I'm not really sure. However to contribute with something concrete to this thread, it's also interesting if not properly relevant, to note that in Perl 6 the possible/alleged ambiguity will be removed, with C-style for loops being renamed to loop, and for being the preferred kind of loop for most situations, while foreach will be phased out:

pugs> sub postfix:<!> (Int $x) { [*] 1..$x } undef pugs> say $_! for =<>; 3 6 4 24 7 5040 10 3628800 undef pugs>

In reply to Re^2: Risks of equivalence between FOR and FOREACH by blazar
in thread Risks of equivalence between FOR and FOREACH by throop

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.