首页 > 代码库 > perl的列表(List)和数组(Array)

perl的列表(List)和数组(Array)

If a scalar is the "singular" in Perl, as we described it at the beginning of Chapter 2, the "pulural" in Perl is represented by lists and arrays.

A list is an ordered collection of scalars. An array is a variable that contains a list. People tend to use the terms interchangeably, but there‘s a big difference. The list is the data and the array is the variable that stores the data. You can have a list value that isn‘t in an array, but every array avriable holds a list (althonght  that may be empty). 

Since lists and arrays share many of the same operations, just like scalar values and variables, we‘ll treat them parallel. Don‘t forget their difference thongh.

 

perl的列表(List)和数组(Array)