Perl Study Notes No. 6

Source: Internet
Author: User

1. Since each Hash has a private iterator (iterator), the loop using each can be nested, because different hash
There are different iterator. Although this is just a footer, we should also tell you that you can use keys or values
Function, reset the iterator (iterator). If the new list is added to this hash, or each
When the function iterates to the last element, it also resets the iterator. If a new key/value is added to the iteration
Yes, it is usually a bad idea. It won't reset the iterator, but it is likely to confuse you and maintenance personnel.

2. The exists function checks whether a key exists in the hash, for example, exists $ hash {key}

3. The delete function deletes a given key (including its corresponding value) from the hash. If this key does not exist, nothing is done. No warning or error message is provided.

4. Use () instead of {} for hash assignment {}! When you enter the value of the specified key, 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.