Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I personally believe I may come out as an annoying little voice, but I have to join the chorus: that is a statement-modifier-for which happens to have the form of Perl-style C<for> acting on $_ - and saving you the need of parens. But by a (generic) Perl-style C<for> it is meant either:

for my $i (LIST) { ... } # or for (LIST) { ... }

"C-style" is in no way bad "because of useless $i variable" since indeed there may not be any $i variable at all: it's "just" a completely different kind of loop altoghether (a more generic one - and that is fundamentally the reason why it exists at all,) which bears the same name as Perl-style one due to the fact that it can easily be disambiguated from the latter by means of the syntax of what's in the parens. I would go as far as claiming that what's in the parens itself in that case is yet another minilanguage (very closely related to Perl itself: it consists of exactly three Perl statements!) that does not fit in other parts of Perl's syntax, and thus a very special case: of course Perl 6 knows better and gives it an entirely different name which IIRC is C<loop> and not by chance takes one letter more wrt "for" since that's for huffmanization and in fact it is thought to be on a much sparser basis to begin with.

If you can't understand the incipit, then please check the IPB Campaign.

In reply to Re^2: C-style for loop by blazar
in thread C-style for loop by mandog

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (2)
    As of 2021-02-28 03:32 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found