Shorter isn't better, nor is longer better. There are often many ways of doing things in Perl, without one being "better" than the other.

Programming means making trade offs. Ideally, code should be correct (well, that usually isn't a trade off), fast, resource friendly, small memory footprint, small amount of code, easy to maintain, easy to understand. Usually, optimizing one thing means pessimizing the others.

What is "best" depends on what your goals are. Code can be quite different whether you have the need for speed, or whether you just want clean, extensible code. And when it comes to "easy to understand", different people prefer different idioms. That's why Perl has many ways of doing things. If you prefer having a language where someone else will decide how things should be done, use Python, or to a lesser extend, Java. But even what one person prefers differs over time. For instance, because they start knowing Perl better, or are getting more experienced in programming in general. Or they are like me, I use more yellows in the morning, and gradually use less yellows and more blues in the course of the day, finishing with deep purples past midnight.

-- Abigail


In reply to Re: Is too little too much? Coding under the microscope... by Abigail
in thread Is too little too much? Coding under the microscope... by snafu

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.