Latest web development tutorials

Introduction to Perl

Perl, a feature-rich computer programming language that runs on more than 100 kinds of computer platform for a wide range, from the mainframe to a portable device, from rapid prototyping to create massive extensible development.

Applications Perl language is very wide, in addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, biology, and other fields. Because of its flexibility, Perl scripting language is called Swiss Army knife.


What is Perl?

Perl was designed by Larry Wall, who shall keep and maintain the programming language.

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

And Perl scripting languages, Perl compiler and linker do not need to run the code, you have to do is write a program and tells Perl to run it. This means that a quick solution for small Perl programming problems and create a prototype for large events to test potential solutions is ideal.

It provides all the features of Perl scripting languages ​​(such as sed and awk), but also they have do not have a lot of features. Perl also supports sed to Perl and awk to Perl translator.

In short, Perl as powerful as C, like awk, sed scripting language is described as easy.


Perl advantage

  • Compared to C, Pascal such "advanced" in terms of language, Perl language directly type variable, dynamic arrays, Hash tables and other more convenient programming elements.
  • Perl has a powerful and flexible features of dynamic languages, and also from C / C ++, Basic, Pascal and other languages ​​were borrowed from grammar rules, which provides a number of redundant syntax.
  • Consolidated variable types and cover operational details, Perl do better than other high-level language: even better (such as Python).
  • Since borrows heavily from other languages ​​grammar, so from other programming languages ​​to Perl language programmer can quickly program and complete the task on hand, which makes the Perl language is an easy to use language.
  • Perl is extensible, we can CPAN ( "the Comprehensive Perl Archive Network " Comprehensive Perl Archive Network) central warehouse we need to find a lot of modules.
  • Perl's mod_perl module allows Apache web server using Perl interpreter.


Perl disadvantage

Perl is also because of the flexibility and "excessive" redundant syntax, also won the write only (write-only) of "reputation" because Perl programs can be written very casual (for example, you can declare a variable without directly), but less likely to write some letters get unexpected results (without error), many Perl program code is hard to read, to achieve the same function code length can vary ten times, which makes the program maintainer (or even writers) difficult to maintain.

Similarly, because of the characteristics of such a random Perl, Perl programmers may lead to some forgotten grammar, so often have to view the Perl manual.

Recommended workaround is to use the program in use strict; and use warnings ;, and the Uniform Code style, using the library, rather than trying to use "hard-coded." Perl can also be as elegant writing code like Python or Ruby and other languages.

In many cases, perl.exe process will take up a lot of memory space, though only temporary, but the feeling is not good.