I think this is largely down to personal preference, but that whoever's going to be reading the code has a very large influence on the decision.
I'm in the habit in the shop I work at of not commenting subs, unless they're very long and it's not obvious from the name or the routine itself what they're doing. Having said that, though, at my Uni it's expected that all subs are commented in depth, and I therefore do commment them there.
It's normally a fairly safe assumption (in my mind) that someone working at the same place you do, with a grasp of what's going on with the system and what the script as a whole should do can figure out what a specific sub is doing (especially if it's well-named).
I guess it depends on the people you work for (or are coding for, in the case of Uni) too .. and on their coding standards (or lack of) .. how much of a personal choice you get then is very much controlled by that.
Just a few quick thoughts ..
-- Foxcub
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.