Day 5. Working with Hashes
Arrays and lists provide a basic way of grouping together scalars, but they're pretty basic as far as data structures go. Perl provides a second form of list data (or a third, if you count raw lists) called hashes. In many situations—depending on the data you've got and what you want to do with it—hashes are better than arrays for storing and accessing data.
Today, then, we'll cover hashes. You'll learn all about
How hashes are different from arrays
Defining hashes
Accessing hash elements
Hashes and context
Using split to split a string into a list (or hash).
Still more patterns
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.