The Perl You Need to Know
April 26, 1999
|
Perl - the very thought evokes a heady, adrenaline rush in the hearts of
hard-core hackers, and an intimidating sense of anxiety in practically
everyone else. The good news is that you don't need to master Perl to make
it useful: Perl is simply a hammer, with which you can build a birdhouse or a
mansion. And you don't need to be Bob Villa to build a birdhouse. In this
article we begin a series on using Perl in web development scenarios. To
start, we ease in with a general introduction to Perl itself. Future articles
will take more in-depth looks at Internet capabilities you can leverage from
within Perl programs. This article assumes Perl 5 as the reference version
of Perl. Developers who have some familiarity with any other programming
language, from BASIC to Pascal to C to JavaScript, will benefit the most from
this article; however, readers with no programming background can still follow
along and pick up most of the concepts.
|
"A minute to learn, a lifetime to master" is the slogan for the
board game Othello, but it might just as well belong to Perl. Put more
accurately, the basic concepts behind Perl are simple to understand,
especially for developers familiar with other programming languages. Yet,
the open-ended flexibility of Perl offers seemingly endless possibilities
-- which is where the exhilaration and/or intimidation usually sets in. The
good news is that you don't need to master Perl to make it useful. Web
developers take heart: Perl is simply a hammer, with which you can build a
birdhouse or a mansion. And you don't need to be Bob Villa to build a\
birdhouse.
In this article we begin a series on using Perl in web development scenarios.
To start, we ease in with a general introduction to Perl itself. The purpose
of this introduction is not to send you off writing enormous Perl programs
-- there are plenty of articles and books which already succeed at this.
Rather, this tutorial should arm you with a basic understanding of Perl so
that you can work through the examples you care about -- web interaction
-- without first needing to become a Perl guru. Future articles will take
more in-depth looks at Internet capabilities you can leverage from within
Perl programs. This article assumes Perl 5 as the reference version of
Perl, which has supplanted the popular but older Perl 4 by several years now.
Developers who have some familiarity with practically any other programming
language, from BASIC to Pascal to C to JavaScript, will benefit the most from
this article; however, readers with no programming background can still follow
along and pick up most of the concepts by inference.
Contents:
Who's Afraid of Perl?
Getting Perl
Running Perl Programs
Perl Variables: Scalars
Table 1. Basic Perl Operators
Perl Variables: Comparing Scalars
Table 2. Perl Comparison Operators
Perl Variables: Lists (aka Arrays)
Perl Variables: Hashes
Perl Functions
Perl Program Flow: Conditionals and Loops
Conclusion
The Perl You Need to Know
Who's Afraid of Perl?
|