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:
print "Howdy, world!\n";
and expect the program to do just that.
Perl is such a language. In fact, this example is a complete
program,[5] 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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access