Sample Code of Multi-digit subscript in perl Array

Source: Internet
Author: User

The normal subscript operations in the perl array must be familiar to everyone. I will not describe them here.
This article describes the multi-digit values under the perl array, which greatly facilitates Array Operations.
Note: These numbers are from 0 to $ # array.

Child Array

Copy codeThe Code is as follows: @ array = (1, 2, 3, 4, 5 );
@ Subarray = @ array [0, 1]; # @ subarray = (1, 2)
@ Subarray2 = @ array [1 .. 3]; # @ subarray2 = (2, 3, 4)
@ Array [] = ("string", 46); # @ array = ("string",) now
@ Array [0 .. 3] = (11, 22, 33, 44); # @ array = (11,22, 33,44, 5) now
@ Array [, 3] = @ array [, 4]; # @ array = (, 5, 5) now
@ Array [0 .. 2] = @ array [3, 4]; # @ array = (5, 5, "", 5, 5) now

Elements can be exchanged in the form of subarrays:

Copy codeThe Code is as follows: @ array [1, 2] = @ array [2, 1];
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.