Ask almost any Perl programmer, and they'll be glad to give you reams of advice on how to program. We're no different (in case you hadn't noticed). In this chapter, rather than trying to tell you about specific features of Perl, we'll go at it from the other direction and use a more scattergun approach to describe idiomatic Perl. Our hope is that, by putting together various bits of things that seemingly aren't related, you can soak up some of the feeling of what it's like to actually "think Perl". After all, when you're programming, you don't write a bunch of expressions, then a bunch of subroutines, then a bunch of objects. You have to go at everything all at once, more or less. So this chapter is a bit like that.
There is, however, a rudimentary organization to the chapter, in that we'll start with the negative advice and work our way towards the positive advice. We don't know if that will make you feel any better, but it makes us feel better.
The biggest goof of all is forgetting to
warnings, which identifies many errors. The second biggest
goof is forgetting to
use strict when it's
appropriate. These two pragmas can save you hours of head-banging when
your program starts getting bigger. (And it will.) Yet another faux
pas is to forget to consult the online FAQ. Suppose you want to find
out if Perl has a
round function. You might try
searching the FAQ first:
Apart from those "metagoofs", there are several ...