Don't fret too much about style and clarity. It's not that there's no such thing as ugly code; but a learner has a lot of trouble knowing which is which. To be honest, even among the Enlightened, "clean code" is not a universally agreed-upon standard. And academic computing (i.e. what you learn in school) isn't what you do in industry. I work at a university, and what they teach the students varies significantly from what actually keeps the system running.

If you take the advice here, you'll have clean code for some acceptable value of "clean". The Monks aren't infallible, but they seem to have reached concensus on important points.

Whatever you do, don't let the urge to write "clean" or "maintainable" code lure you into writing some ugly abomination of brain-deadness. Don't be afraid to write good code just because it might be hard to understand. "Easy to maintain" is confused far too often with "grossly inefficient and overly verbose", especially in academic circles. Far too many people are scared off by map or grep, because they wrongly consider it obscure. Good code is frequently not immediately transparent: that's not a bad thing. If you set out to write beautiful code, you'll find it's both clear and efficient, for acceptable values of "clear" and "efficient".

And Perl's more strongly typed than people seem to think. We just blur the issue with "contexts" and limit the types to scalars, lists, hashes, functions, etc. Lisp, sh, and Forth are loosely typed: Perl is somewhere between them and Java.


In reply to Re^3: Not A Rockstar File Manipulator Today by mpeever
in thread Not A Rockstar File Manipulator Today by koolgirl

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.