Creating Nested Data Structures with References
Subroutines are not the only place where references come in handy. The other significant feature that becomes possible with references is complex data structures such as multi-dimensional arrays. In this section we'll look at constructing complex data structures with nested arrays and hashes using references and anonymous data. Later in the lesson, in “Accessing Elements in Nested Data Structures,” we'll look at getting data back out of the nested data structures you've just created.
What Is a Nested Data Structure?
Normally in Perl, lists, arrays, and hashes are flat, one dimensional, containing nothing but scalars. Combine multiple lists, and they all get squished down to a single one. Hashes ...
Get Sams Teach Yourself Perl in 21 Days, Second 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.