Perl Study Notes No. 4

Source: Internet
Author: User

1. ChildProgram(In common ?), It starts with "&" in a call to distinguish it from "$" and @
2. the scalar in the subroutine block is global without any modification. This subroutine is called multiple times in a file and can be modified multiple times.
3. The value of the expression calculated in the last step in the subroutine will be used as the return value... (the real TM is a lazy person)
4. The parameter list of the subroutine is provided only when it is called !!! Save in @ _
5. Use the my statement in the subroutine to create private variables, such as Sub max {My ($ M, $ n) =@_; $ m> $ n? $ M: $ N ;}
6. Variables cannot be repeatedly defined in the same scope.
7. When you call a subroutine, add & to avoid conflict with embedded functions.
8. $ # array is only the subscript of the last element. The actual number must be + 1 !!
9. Pop and shift cannot specify elements...
10. Use <> to read the file... it's too late...
11. printf () is similar to C, but the parameters change. the output number is usually % G, which can automatically identify the type of number used; % s is a string; % d is a decimal integer, % x sixteen, % o eight ;...

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.