Sorry, I misread the code. I suppose it could be rewritten like so:

my @grid = map [ @$_ ], ( [ '01' .. '12' ] ) x 12;

but yeah, that’s past the tipping point up to which it might make more sense than

my @grip = map [ '01' .. '12' ], 1 .. 12;

What is the difference between a list of 12 integers and a list of 12 references? Besides the memory consumed.

The difference is that the value that comes from the list is used by the map expression. With your approach, only the list length matters, while the list elements are demoted to dummy constants, so 1 .. 12 is arbitrary and could just as well be ( undef ) x 12 or split //, ' ' x 12 or whatever. It basically offends my sensibilities to have something in the code which amounts to nothing but an ornament. Not enough that I’d take the silly approach outlined in the first snippet above, though. I just try to avoid it; but the line is blurry.

Makeshifts last the longest.


In reply to Re^12: Thread on Joel on software forum : "I hate Perl programmers." by Aristotle
in thread Thread on Joel on software forum : "I hate Perl programmers." by techcode

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.