Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
If a scalar is the “singular” in Perl, as we described it at the beginning of Chapter 2, the “plural” 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 variable holds a list (although that list may be empty). Figure 3-1 represents a list, whether it’s stored in an array or not.
Since lists and arrays share many of the same operations, just like scalar values and variables do, we’ll treat them in parallel. Don’t forget their differences though.