A.2 Perl as a Natural Language
Natural languages, languages (such as English) that people use on a
daily basis to communicate with each other, are rich and complete. Most
natural languages allow the speaker to express themselves succinctly and
clearly. However, most natural languages are also full of arcane
constructs that carry over from the language's past. In addition, for a
given natural language, it is impossible to fully master the vocabulary
and grammar because they are very large, extremely complex, and always
changing.
You may wonder what these facts about natural languages have to do with
a programming language like Perl. Surprising to most newcomers to Perl,
the parallels between Perl and a natural language like English are
striking. Larry Wall, the father of Perl, has extensive scholastic
training as a linguist. Larry applied his linguistic knowledge to the
creation of Perl, and thus, to the new student of Perl, a digression
into these language parallels will give the student insight into the
fundamentals of Perl.
Natural languages have the magnificent ability to provide a clear
communication system for people of all skill levels and backgrounds.
The same natural language can allow a linguistic neophyte (like a
three-year-old child) to communicate herself nearly completely to
others, while having only a minimal vocabulary. The same language also
provides enough flexibility and clarity for the greatest of philosophers
to write their works.
Perl is very much the same. Small Perl programs are easy to write and
can perform many tasks easily. Even the newest student of Perl can
write useful Perl programs. However, Perl is a rich language with many
features. This allows the creation of simple programs that use a
"limited" Perl vocabulary, and the creation of large, complicated
programs that seem to work magic.
When studying Perl, it is helpful to keep the "richness" of Perl in
mind. Newcomers find Perl frustrating because subtle changes in syntax
can produce deep changes in semantics. It can even be helpful to think
of Perl as another natural language rather than another programming
language. Like in a natural language, you should feel comfortable
writing Perl programs that use only the parts of Perl you know.
However, you should be prepared to have a reference manual in hand when
you are reading code written by someone else.
The fact that one cannot read someone else's code without a manual handy
and the general "natural language" nature of Perl have been frequently
criticized. These arguments are well taken, and Perl's rich syntax and
semantics can be confusing to the newcomer. However, once the initial
"information overload" subsides, most programmers find Perl exciting and
challenging. Discovering new ways to get things done in Perl can be
both fun and challenging! Hopefully, you will find this to be the case
as well.