2.1
A Low and Long Learning Curve
A nice thing about Perl is that you can learn to write programs
fairly quickly; in essence, Perl has a low learning
curve. This means you can get started easily, without
having to master a large body of information before writing useful
programs.
Perl provides different styles of writing programs. Since these are
beyond the scope of this book, I won't go into details, except
to mention the popular style called imperative programming that
you'll learn in this book. The equally popular style called
object-oriented programming is also well-supported in Perl. Other
styles of programming include functional programming and logic
programming.
Although you can get started quickly, learning all of Perl will
certainly take awhile, if that's your goal. Most people learn
the basics, as presented in this book, and then learn additional
topics as needed.
Let's get a few elementary definitions out of the way:
-
What is a
computer program?
-
It's a set of instructions written in a particular programming
language that can be read by the computer. A program can be as simple
as the following Perl language program to print some DNA sequence
data onto the computer screen:
print 'ACCTGGTAACCCGGAGATTCCAGCT';
The Perl language programs are written and saved in
files, which are
ways of saving any kind of data (not only programs) on a computer.
Files are organized hierarchically in groups called
folders
on Macintosh or Windows systems or directories in Unix or Linux
systems. The terms folder and directory will be used interchangeably.
-
What is a programming language?
-
It's a
carefully defined set of
rules for how to write computer programs. By learning the rules of
the language, you can write programs that will run on your computer.
Programming languages are similar to our own natural, or spoken
languages, such as English, but are more strictly defined and
specific to certain computer systems. With a little bit of training,
it's not difficult to read or write computer programs. In this
book you'll write in Perl; there are many other programming
languages.
A program that a programmer writes is also called source code, or
just source or code. The source code has to be turned into machine
language, a special language the computer can run. It's hard to
write or read a machine language program because it's all
binary numbers; it's often called a
binary executable. You
use the Perl interpreter (or compiler) to turn a Perl program into a
running program, as you'll see later in this chapter.
-
What is a computer?
-
Well, ...
Okay, silly
question.
It's that machine you buy in computer stores. But actually,
it's important to have a clear idea of what kind of machine a
computer is. Essentially, a computer is a machine that can run many
different programs. This is the fundamental flexibility and
adaptability that makes the computer such a useful and
general-purpose tool. It's programmable;
you will learn how to program it using the Perl programming language.