Coding style is very much a matter of personal preference. For instance, I think perlstyle says you should omit the last ; in a block. Personally I disagree - if you add some code after that line later, it generates a syntax error unless you spot it and change it. But that might just be me.....
Having maintained other peoples code for far too many years, the one thing I would say is comment. Lots and lots of comment. Not just:
#this bit does xyz
sub xyz....
which can be difficult to see in a long script, but
#######################################
# subroutine xyz - does xyz, abc, zz plural z alpha
#######################################
sub xyz..
Or your own personal variant of it. Also, give variables reasonably explanatory names, and make fairly liberal use of whitespace.
Those would be my suggestions anyway. Why not post a code snippet and let the monks bitch about it? :-)
charles.
Addendum: applause for wanting to make your code easier to read though - most people wouldn't bother!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.