I think that is too harsh. I often put scalar in when it is
not neededfor the same reason that I use parens which are
not needed - I know that the code is likely to be edited
by someone who has not memorized the various contexts.
Now in a perfect all Perl world, I would agree with you.
But when my code needs to be understood by programmers who
are not primarily Perl programmers, well I am confident
that I can teach them to remember that Perl has both
scalar and list contexts, and they do different things.
But when they have to edit my Perl after a month in other
languages, I do not believe that they will retain fast
reactions for which syntactic constructs imply scalar
context.
So I leave in the crutch, and since everyone knows that I
do this deliberately, I don't see any reason to comment
it.
OTOH in code which will only be seen by people who
are supposed to be competent Perl programmers, well
I drop it...
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.