And while loops are just gotos in disguise. Pretty much anyway.

While i posted somewhat tongue-in-cheek im curious: Is that really true in perl?

and somewhere in the block, we have the increment of the variant.

I suppose you could code it that way, but you can also use a continue block:

while (EXPR) { } continue { STMTS; }

Which can be useful at times and is pretty much what Perl does anyway. Ie:

for(INIT;EXPR;INCR) { STMTS; }

more or less becomes:

{ INIT; while (EXPR) { STMTS; } continue { INCR; } }

I think how much value you place on your second point will vary depending on your exposure to C and other C like languages. Personally I always hated 3 arg for loops finding them difficult to read, but lately ive been doing a lot of C and have come to appreciate them a lot more (probably becuase I find reading them not to be so confusing as it used to be).

Anyway, i stuck the smiley face on there for a reason. I just thought the fact that the two constructs are identical in perl (insofar as perl converts 3arg for loops into while continue constructs anyway) made your comment a touch ironic. :-)

---
demerphq


In reply to Re^5: Regexp to extract groups of numbers by demerphq
in thread Regexp to extract groups of numbers by neilh

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.