Perl is the abbreviation of Practical Extraction and Report Language, which can be translated as "Practical Report Extraction Language". Perl is a high-level, general-purpose, literal, dynamic programming language. Perl was originally designed by Larry Wall and published on December 18, 1987. Perl borrows features from C, sed, awk, shell scripts, and many other programming languages. The most important feature of Perl is that Perl integrates regular...
Perl is a high-end, general-purpose, interpreted, dynamic programming language family. In order to make report processing on UNIX easier, the original designer Larry Wall decided to develop a universal scripting language, which was published on December 18, 1987. Currently, the Perl language family includes two branches, Perl 5 and Perl 6 (under development). Although Perl is not an official acronym, there are various reverse acronyms, including "Practical Extraction and Reporting Language."
Perl borrows features from C, sed, awk, shell scripts, and many other programming languages. The most important feature is Perl's internal integration of regular expressions and the huge third-party code library CPAN.
Beginning in 2000, Larry Wall began to develop Perl 6 as the successor of Perl; however, the syntax of the Perl 6 language has many changes, so Perl 6 is regarded as another member of the Perl family. language.
Perl language has a wide range of applications. In addition to CGI, Perl is used in graphics programming, system management, network programming, finance, biology and other fields. Due to its flexibility, Perl is called the Swiss Army Knife of scripting languages.
Tips: If you have learned PHP, ASP and other programming languages, it will help you understand it faster Perl programming.
Let’s experience the first Perl program!
Perl's Hello World program
The following is a simple program that outputs Hello World on the standard output device. This program is often used as the first example when starting to learn a programming language:
Instance
#!/usr/bin/env perl print "Hello, world!\n";
Run Instance»
Click the "Run Instance" button to view the online instance
If you have perl version 5.10 or above, you can also do this:
Instance
#!/usr/bin/env perl use 5.010; say "Hello, world!";
Run instance»
Click "Run" Instance" button to view online examples
This program will output a line of string: "Hello, world!", and a newline.
Tips: Our perl tutorial will help you learn perl knowledge from beginner to advanced. If you have any questions, please go to the PHP Chinese website perl community to ask your questions, and enthusiastic netizens will answer them for you.
Perl Advantages and Disadvantages
Advantages
In order to achieve such a goal, and because Larry Wall himself is A linguist, he used a lot of linguistic thinking when designing the Perl language. Compared with "high-level" languages such as C and Pascal, the Perl language directly provides more convenient programming elements such as generic variables, dynamic arrays, and Hash tables. Perl has the powerful and flexible characteristics of a dynamic language, and also borrows grammar rules from C/C, Basic, Pascal and other languages, thus providing a lot of redundant grammar.
Allows programmers to ignore the details of computer internal data storage, types, processing methods, calculation rules, and even memory boundaries, etc., and focus on the required program logic. In this regard, many Perl programmers believe that currently only generic languages such as Perl and Python can be called "high-level" languages, while C, Pascal and even C can only be called "intermediate and high-level" languages. It can be said that Perl does a better job than Python in unifying variable types and concealing operation details.
Due to borrowing a lot of syntax from other languages, programmers who switch to Perl language from other programming languages can quickly start writing programs and complete tasks, which makes Perl language an easy-to-use language.
Disadvantages
It is precisely because of Perl's flexibility and "excessive" redundant syntax that it gained the write-only (write -only), because Perl programs can be written very casually (for example, variables can be used directly without declaration), but you may get unexpected results (without reporting an error) by writing a few fewer letters. Many Perl The code of the program is difficult to read, and the length of the program code that implements the same function can vary ten to a hundred times, which makes it difficult for the maintainer (or even the writer) of the program to maintain it.
Similarly, because of the casual nature of Perl, some Perl programmers may forget syntax and have to check the Perl manual frequently. In this regard, the book "Learning Perl" recommends frequent use of Perl programming.
The recommended solution is to use use strict; and use warnings; in the program, unify the coding style, and use libraries instead of using "hard coding" yourself. Perl can also write code as elegantly as languages such as Python or Ruby.
Content covered in this Perl tutorial manual
This Perl tutorial covers all basic and advanced knowledge of Perl, including Perl syntax, Perl data types, Perl variables, Perl scalars, Perl arrays, Perl ha Hash, Perl operators, Perl functions, Perl object-oriented, Perl process management, etc.
Tips: Each chapter of this tutorial contains many Perl examples. You can directly click the "Run Example" button to view the results online. These examples will help you better understand and use Perl.
Latest chapter
- Perl POD 文档 2016-10-17
- Perl 进程管理 2016-10-17
- Perl 包和模块 2016-10-17
- Perl CGI编程 2016-10-17
- Perl 数据库连接 2016-10-17
- Perl 面向对象 2016-10-17
- Perl Socket 编程 2016-10-17
- Perl 发送邮件 2016-10-17
Related courses
- The latest ThinkPHP 5.1 world premiere video tutorial (60 days to become a PHP expert online training course) 2022-02-17
- Let's briefly talk about starting a business in PHP 2023-01-04
- Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things 2018-01-25
- Login verification and classic message board 2018-03-02
- Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum] 2022-06-28
- Quick Start Node.JS Full Version 2022-09-30
- Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance) 2022-12-08
- Horse soldier spring video tutorial 2022-04-12