only one idiom

But that is the absolute antithesis of what Perl (and all VHL languages) are all about.

We could (and for a while did) program using just a single flow control idiom: goto. If reducing the number of idioms we used was a virtue, we'd still perform the initialisation like this:

my @e = 'a'..'z'; my @n = 1..10; my $href; my $ie = 0; OUTER: my $e = $e[ $ie ]; my $in = 0; INNER: my $n = $n[ $in ]; $href->{ $e }{ $n } = 1; $in = $in + 1; if( $in < @n ) { goto INNER; } $ie = $ie + 1; if( $ie < @e ) { goto OUTER; }

We don't any more for very good reasons.

You've pointed out many times that the C-style for loop is far more flexible than the perlish for loop, but we have both and most people prefer the latter for most uses. (Albeit that some use it when it is less appropriate.)

Using one idiom instead of more improves readability, IMO

IMO, if you think about it a little more, you'll change your mind.

By definition, the more general an idiom, the more situations it is applicable in. Which, also by definition, means the more closely you need to inspect it to understand which of those situations it is being used for in this case.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^7: I hate nested loops by BrowserUk
in thread I hate nested loops by rastoboy

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.