My own take
Posted Oct 10, 2005 21:12 UTC (Mon) by
felixfix (subscriber, #242)
Parent article:
Book Review: Perl Best Practices (NewsForge)
I have a copy, and have almost finished reading it. Some of it strikes me as pure busy work, unworthy of being called Best Practices. For instance, he likes "{" on the end of the line introducing a block, "}" on a line by itself, indented to match the "{" line, and so far so good. But then he wants "else {" on a line by itself, indented to match the "}" line, on the basis that "else" is important and should be at the beginning of the line to be in a consistent position. But the construct "} else {" would also be in a consistent position, only differing by having two (consistent) characters in front of it. This seems like a strange best practice.
He also disparages using two double quotes ("") for the empty string, as double quotes are for interpolated strings with embedded variables. But don't use two single quotes (''), as that could be mistaken for a single double quote. Never mind that Perl is pretty good at detecting unterminated strings, and usually tells you where they started. What he wants is the horrible "q{}". Ditto for a single space.
He prefers "for (list) {}" rather than the C "for ($i = 0; $i < end; $i++) {}" because it is not obvious to novices. But he ignores what to do with humonguous lists with millions of entries; is it going to create a huge second copy or not?
There's a lot of nice stuff in this book. But there's enough trivial poorly rationalized stuff to make it less than sterling. I usually buy two copies of good books, one for the office and one for home. One copy of this is enough.
(
Log in to post comments)