Chapter 1. An Overview of Perl
1.1. Getting Started
We think that Perl is an easy language to learn and use, and we hope to convince you that we're right. One thing that's easy about Perl is that you don't have to say much before you say what you want to say. In many programming languages, you have to declare the types, variables, and subroutines you are going to use before you can write the first statement of executable code. And for complex problems demanding complex data structures, declarations are a good idea. But for many simple, everyday problems, you'd like a programming language in which you can simply say:
and expect the program to do just that.print "Howdy, world!\n";
Perl is such a language. In fact, this example is a complete program, and if you feed it to the Perl interpreter, it will print "Howdy, world!" on your screen. (The \n in the example produces a newline at the end of the output.)
And that's that. You don't have to say much after you say what you want to say, either. Unlike many languages, Perl thinks that falling off the end of your program is just a normal way to exit the program. You certainly may call the exit function explicitly if you wish, just as you may declare some of your variables, or even force yourself to declare all your variables. But it's your choice. With Perl you're free to do The Right Thing, however you care to define it.
There are many other reasons why Perl is easy to use, but it would be pointless to list them all here, because that's what the rest of the book is for. The devil may be in the details, as they say, but Perl tries to help you out down there in the hot place too. At every level, Perl is about helping you get from here to there with minimum fuss and maximum enjoyment. That's why so many Perl programmers go around with a silly grin on their face.
This chapter is an overview of Perl, so we're not trying to present Perl to the rational side of your brain. Nor are we trying to be complete, or logical. That's what the following chapters are for. Vulcans, androids, and like-minded humans should skip this overview and go straight to Chapter 2, "Bits and Pieces", for maximum information density. If, on the other hand, you're looking for a carefully paced tutorial, you should probably get Randal's nice book, Learning Perl (published by O'Reilly & Associates). But don't throw this book out just yet.
This chapter presents Perl to the other side of your brain, whether you prefer to call it associative, artistic, passionate, or merely spongy. To that end, we'll be presenting various views of Perl that will give you as clear a picture of Perl as the blind men had of the elephant. Well, okay, maybe we can do better than that. We're dealing with a camel here (see the cover). Hopefully, at least one of these views of Perl will help get you over the hump.
Copyright © 2002 O'Reilly & Associates. All rights reserved.