Perl style

Part of what you should learn from this book is a sense of good Perl style. Style is, of course, a matter of preference and debate. I won't pretend to know or demonstrate The One True Style, but I hope to show readers one example of contemporary, efficient, "effective" Perl style.

The fact that the code appears in a book affects its style somewhat. Examples can't be too verbose or boringeach one has to make one or two specific points without unnecessary clutter. Therefore, you will find the following:

  • I don't use English . It's just too verbose for this little book. Furthermore, English is not common practice among Perl programmers, and scripts that use English suffer a speed penalty. This is not to say that English is not useful, just that you won't see it here.

  • Not everything runs cleanly under -w or use strict (see Item 36). I advise all Perl programmers to make use of both -w and use strict regularly. However, starting off all the examples with my($this, $that) isn't going to make them more readable, and it's readability that's important here.

  • I generally minimize punctuation (see Item 10). Veteran Perl 4 programmers may find the lack of parentheses unnerving, but it grows on you.

  • Finally, I try to make the examples meaningful. Not every example can be a useful snippet, but I've tried to include as many pieces of real-world code as possible.

Effective Perl Programming. Writing Better Programs with Perl
Effective Perl Programming: Writing Better Programs with Perl
ISBN: 0201419750
EAN: 2147483647
Year: 1996
Pages: 116

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: