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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.