New Ways with Arrays

In the following section, we will discuss a set of array functions that make several powerful data structures possible in Perl.

A List as a Stack

Until now, lists (and arrays) have been presented as linear arrangements of data with indexes that make it possible to access each element, as shown here:

Use your imagination for a moment and imagine the array elements piled up vertically with the element having the highest index at the top, as shown here:

Notice that there are no index numbers in this figure. The reason is that ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.