http://www.perlmonks.org?node_id=999800


in reply to 78/80 chars perl line still a meaningful rule

It's a simple question, with, for me, a complicated answer. It boils down to

Reading and Comprehension are important points: if there are multiple lines much longer than 80 characters, the eye can't take it all in, and the head has to move as well. The eye's visual acuity is actually quite limited, but the brain does an excellent job of pretending that it's better than it is. As the line of code gets longer, it gets harder to find where the beginning of the next line is.

Maintaining code, once you comprehend it, is vital. And it could be that you're not on your favourite workstation with multiple gigantic screens -- you might be limited to a 25x80 screen. Having long lines cut off or wrapped can be quite irritating. (I've just been working on some scripts within Jenkins, editing in dialog boxes, and it's difficult to see where a line is a continuation.)

Getting a hard copy of your code can be quite useful -- but that's for naught if the print function either cuts the long lines or wraps them where you don't want it to. It's much better to do your own wrapping (I use gq{ in vim, for example) and have it display and print out correctly. Yes, the file will be longer -- too bad. :)

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: 78/80 chars perl line still a meaningful rule
by greengaroo (Hermit) on Oct 19, 2012 at 17:56 UTC

    I agree with that!

    And may I add that consistency in your indentation is more important than the length of your lines.

    There are no stupid questions, but there are a lot of inquisitive idiots.