Well, in this case, the code had been in a loop. The loop got large, so moved contents out, but then the loop control words no longer worked. In this case, the loop control words made it clear the derived sub, where the code in the main loop would go next. I used those constants (and have done similar in the past) for exactly those reasons -- even though the loop contents were no longer "inline", due to the use of such constants to indicate what they did in their previous loop the code was actually easier to understand -- more clear.

If I had come up with a new or different set of constants, I don't think it would have been as clear. As for constants being upcased? That's so 80's. :-) Seriously -- all caps hurt my eyes and fingers typing -- I'll usually capitalize something, but there are many cases where doing so hurts perception and understanding.

An example would be several math constants (displaying these on pm in code blocks, is bugged, so you'll have to use your imagination a bit: ( But the 3 chars are Φ (Phi), ɸ (phi) and π (pi) ).

sub Phi () { .5 * (5.**.5 - 1) } sub Φ () { goto &Phi } sub phi () { .5 * (1. + 5.**.5) } sub ɸ () { goto &phi } sub pi () { 4 * atan2(1, 1) } sub π () { goto &pi }
If you upper-cased these, how would you tell Phi from phi. In the greek names (on the right which display as characters on modern systems), they are also the upper and lower case version of the greek phi. Pi, uses a lower case 'pi' just as it is in the english text version.

Anyway, it's all about context... ;-)...


In reply to Re^4: Curious: are anon-hashes in random order? (updated) by perl-diddler
in thread Curious: are anon-hashes in random order? by perl-diddler

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.