I (try to) opt for a "rôle-based" naming style; some might call it "punning". Since the vast majority of my loops aren't labeled, there's always a reason for labelling those that are. That reason is the operation I wish to perform on it: redo, next, or last (you'll see goto doesn't really fit into this mold, but I use it even less).

Name the loop to make the "something LABEL" phrase self-explanatory. For instance, in your example you could name the loop TAG; "last TAG" means just that. So would "next TAG" and "redo TAG".

rinceWind suggests much the same thing, for seemingly different reasons. Perhaps some linguist can help us make sense of whether they are, in fact, different reasons?


I find your variable naming style somewhat inconsistent (=~ /^I do it differently$/). You name arrays in plural, but hashes in singular. Your example is biased: you give "@plural_noun", referring to the entire collection, and "$singular_noun{specific}", referring to an element. I try to keep everything singular; my arrays tend to be "@singular_noun", so that "$singular_noun[INDEX] makes singular sense. Plurality or singularity stem from my choice of line noise: $, @ or %. And I don't pluralise twice.


In reply to Re: Thoughts on naming loop LABEL: by ariels
in thread Thoughts on naming loop LABEL: by ybiC

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.