Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Introduction to Perl

Introduction to Perl

Perl is a feature-rich computer programming language that runs on more than 100 computer platforms and is widely applicable, from mainframes to portable devices, from rapid prototyping to large-scale scalable development.

Perl has a wide range of applications; besides CGI, Perl is used in graphics programming, system administration, network programming, finance, biology, and other fields. Due to its flexibility, Perl is known as the Swiss Army knife of scripting languages.


What is Perl?

Perl is a programming language designed by Larry Wall, who continuously updates and maintains it.

Perl has the power and flexibility of a high-level language (such as C). In fact, you will see that many of its features are borrowed from the C language.

Like a scripting language, Perl does not need a compiler and linker to run code; all you need to do is write the program and tell Perl to run it. This means Perl is ideal for quick solutions to small programming problems and for creating prototypes for large events to test potential solutions.

Perl provides all the features of scripting languages (such as sed and awk) and also has many features they do not have. Perl also supports translators from sed to Perl and from awk to Perl.

In short, Perl is as powerful as C and as convenient as scripting languages such as awk and sed.


Advantages of Perl


Disadvantages of Perl

It is also precisely because of Perl's flexibility and "excessive" redundant syntax that it has earned the "reputation" of being write-only, because Perl programs can be written very casually (for example, variables can be used without declaration), but missing a few letters may produce unexpected results (without reporting an error). The code of many Perl programs is hard to read, and the length of code implementing the same function can differ by ten or a hundred times, which makes it difficult for maintainers (even the authors) to maintain.

Similarly, because of Perl's casual nature, some Perl programmers may forget the syntax and have to consult the Perl manual frequently.

The recommended solution is to use use strict; and use warnings; in your programs, unify the code style, and use libraries instead of "hardcoding" yourself. Perl can also write code as elegantly as languages such as Python or Ruby.

Many times, the perl.exe process takes up a lot of memory space; although only temporarily, it feels bad.