P is for Practical PerlMonks

### Comment on

 Need Help??
I find it significantly easier and faster to parse the intent.

Could you quantify (in some fashion) what you mean by "significantly easier and faster"?

```my \$mol = ( \$n == 42 ) ? 'forty two' : '';
```my \$mol = '';
\$mol = 'forty two'
if  42 == \$n;

I find your version quite horrible to parse.

• Is that one statement or three?

Oh! It's two!

• And why is it (are they) all squished up like that?

It looks like the the code-wrap routine has been given some ridiculously narrow width limit.

• Why is he comparing a literal against a variable?

Is the literal's value likely to suddenly change?

(Yes. I am aware of the justifiction for the backward logic. :)

As for your last example, I find it almost incredulous that you would code that; and almost impossible to parse without reformatting it.

Why not just:

```my \$mol =  defined \$n ? ( \$n == 42 ? 'fourty two' : '' ) : 'n/a';

I also find the concentration on the minutia of single statements far less important than the overall flow of the code.

That is, when scanning the code, I only need to recognise that \$mol has been initialised, and then the next step and the next. I'll only be concerned with what it was initialised to once I understand the overall flow; and if I suspect that might be the source of the problem I'm looking for, or otherwise needs closer inspection.

I don't need to know all the details of each line (or 3 lines!) of code from an instantaneous glance. If I have to read the line twice to understand what it does -- maybe take 2 seconds instead of 1/2 a second -- it is no biggy in the scheme of things. But understanding the overall flow of the subroutine or block is far more important, and that -- for me at least -- means being able to see as much of that subroutine or block as -- clearly defined steps -- as possible. Which is why I infinitely prefer the one line versions to your 3 or 5 line examples.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

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, 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, 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.

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-02-22 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When it is dark outside I am happiest to see ...

Results (293 votes). Check out past polls.

Notices?