Book Home Programming PerlSearch this book

24.3. Programming with Style

You'll certainly have your own preferences in regard to formatting, but there are some general guidelines that will make your programs easier to read, understand, and maintain.

The most important thing is to run your programs under the use warnings pragma. (You can turn off unwanted warnings with no warnings.) You should also always run under use strict or have a good reason not to. The use sigtrap and even the use diagnostics pragmas may also prove of benefit.

Regarding aesthetics of code layout, about the only thing Larry cares strongly about is that the closing brace of a multiline BLOCK should be "outdented" to line up with the keyword that started the construct. Beyond that, he has other preferences that aren't so strong. Examples in this book (should) all follow these coding conventions:

Larry has his reasons for each of these things, but he doesn't claim that everyone else's mind works the same as his does (or doesn't).

Here are some other, more substantive style issues to think about:



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.


HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека