PHPer learning perl (1)

Source: Internet
Author: User
Tags learn perl
I have to say that perl and php are two very similar languages. For php students like me, it is easy to learn perl. Here are some differences between perl and php: variables: The Integer Variables on perl are actually stored in the floating-point register of the computer and viewed as floating-point numbers, that is, the integer value is floating.

I have to say that perl and php are two very similar languages. For php students like me, it is easy to learn perl. Here are some differences between perl and php: variables: The Integer Variables on perl are actually stored in the floating-point register of the computer and viewed as floating-point numbers, that is, the integer value is floating.

I have to say that perl and php are two very similar languages. For php students like me, it is easy to learn perl.

Here are some differences between perl and php that I have learned:

Variable:

The integer variables on perl are actually stored in the floating-point register of the computer and viewed as floating-point numbers. That is, the integer number is a special case of floating-point numbers. This should be the exclusive feature of perl, not only different from PHP, but also different from other languages I have ever seen.

OPERATOR:

Perl has a ** (Power) operator, while php needs to use the pow () function like C to perform power multiplication.
There is also an interesting comparison operator in perl: <=>, binary, returns-, 1, indicating that the Left value is less than the right value, and the left value is equal to the right value, the left value is greater than the right value. This is used for numbers. There is a string version: cmp, and the return value is the same as the number version. In php, only one character string comparison function strcmp ($ str1, $ str2) is similar to this comparison operator: Return negative value, 0, positive value, representing $ str less than, equal, greater than $ str2.
It is also interesting to see that the perl auto-increment (++) Auto-Subtract (-) symbol can be used on strings, such

$str= 'adc';++$str; #str=='add'

Perl strings can be repeated using x, for example

$str = 't' x 5; #str == 'ttttt'

The difference between strings and php is that strings in php can be connected through ",", but not in perl. ", similar to C.

Original article address: PHPer learning perl (1). Thank you for sharing it with me.

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.