Differences between PHP and Perl

Source: Internet
Author: User

1. variable name Definition
Perl's common variables, hash variables, and array variables start with $, %, and @, respectively, and all PHP variables start with $, which seems to be more concise. In addition, the PHP hash array itself is already sorted. Perl needs to use tie: ixhash to obtain the hash array in the descending order. I personally feel that PHP variable names are better defined than Perl.

2. Number of functions
There are few basic functions in Perl, and most of them are close to C. In my opinion, Perl is more advanced and systematic. There are many PHP functions, far more than Perl. php seems to need a function, so there are a lot of complicated functions, and there are similar or even repeated functions, this is also one of the reasons why some "Orthodox" people do not like PHP.

3. Number of extension modules
Perl has many extension modules and involves almost all fields. Therefore, Perl is almost omnipotent. CPAN is the base camp of Perl extension modules. The set of extension modules in PHP is called Pear. There are also many modules, but they are still fewer than CPAN.

4. Object-oriented capabilities
Perl's object-oriented model is implemented by modules. It does not feel like OO in the true sense, but functions and variable packaging in the general sense. The same is true for PhP4. After PhP5, the object-oriented features have been greatly improved, and almost all oo features have been available. Although it is not as good as Java.

5. cross-platform capabilities
Both are cross-platform, but Perl is more inclined to Linux/Unix. ActivePerl is used on Windows, and mod_perl seems to only work with Apache (no combination of IIS and mod_perl has been attempted, so it is not clear whether it can be implemented). php takes into account multiple environments. The performance on Windows is almost the same as that on Linux/Unix and can be freely combined with Apache/IIS, it should be said that PHP is doing well and can be matched freely.

Summary

The most direct feeling is that PHP is used as an embedded script on the server. There are two words: convenience. However, due to its convenience, some principles are sacrificed, and sometimes some annoying "convenience" occurs. For example, the post/get content is automatically added with the "/" setting. At the beginning, I don't understand it, and I can't figure out where something went wrong. Later I realized it was a setup problem, at this time, the feeling is that PHP is superfluous. Perl is a traditional language. When it was born, it was not designed for dynamic web pages. Therefore, it may not be as convenient as PHP when used for dynamic web pages, but Perl is comprehensive, it is a strong point of Perl to do batch. It is complicated to do. It may be easy to solve it with Perl.

In general, these two languages are basically the same, so as long as one of them is used, the other is easy to use, and it is almost "Easy to use ".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.