Perl Study Notes No. 3

Source: Internet
Author: User
Tags scalar

1. A given expression has different meanings in different contexts
2. In the scalar context, Nums returns the number of its elements. In the list context, its elements are returned.
3. Print @ Nums; each element is not separated by spaces unless print "@ Nums ";
4. Print Nums; it is directly used as a list, not a scalar
5. If a scalar expression is used in the list context, it will convert the scalar to a list with only one element.
6. The correct method to leave the array empty @ Nums = ();
7. Print "there are", scalar @ Nums, "numbers! /N "; scalar is not a function. It only tells Perl to process Nums by scalar.
8. <stdin> for the input list, use Ctrl + D to end // Of course, it is in UNIX
9. Chomp is the same for the list... chomp (@ Nums); // return the number of linefeeds removed. It seems a bit useful at last.

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.