Perl study note No. 1

Source: Internet
Author: User
Tags scalar

1. Write the code and # Run the CHMOD 755 file name directly.
2. debugging is also possible, # Perl-M file name
3. Transfer characters only play a role in double quotation mark strings, and scalar variable interpolation is also the same
4. Use a scalar variable directly, starting with $
5. Use string connection.
6. Use/before the variable. The variable will not be interpolated. "/$ variable name"
7. Use {} to enclose variables to ensure matching
8. 2 **, 3 to the power of 2 // It's really convenient.
9. Combine operators on the left to calculate the left, and combine operators on the right to calculate the right. // See the appendix.
10. The string '0' is not null, but is false when it is used for if judgment. The variable is not assigned a value, and its value is UNDEF. If is used for judgment, the value is false.
11. Input $ text = <stdin> from the keyboard;
12. Chomp (# text); remove the line break at the end of $ text, such as chomp (# text = <stdin> );
13. Chomp only removes one linefeed // Number of linefeeds, And the return value is the number of linefeeds removed from it.
14. Brackets can be omitted unless they are removed.
15. All numbers are internally converted to double (double-precision floating point number). Some special operations are converted to int (integer) calculations, such as %
16. Defined Function, used to determine whether the variable is UNDEF

Operator priority and associativity (from high to low)
Associative Operators
Parameters of left brackets and list Operators
Left->
++ -- (Auto increment and auto increment)
Right **
Right /! ~ +-(Unary operator)
Left = ~ !~
Left */% x
Left +-. (binary operator)
Left <>
Named unary operators (-x filetests, RAND)
<<=>> = Lt le GT Ge ("unequal ")
=! = <=> EQ ne CMP ("equal ")
Left &
Left | ^
Left &&
Left |
.....
Right? (Ternary operator)
Right = + =-=. =
Left, =>
List operators (rightward)
Right not
Left a nd
Left or XOR

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.