Summary

Today, we completed your background in list data with a discussion of hashes, which are similar to arrays and lists except that they arrange data into keys and values as opposed to simply storing elements in a numeric order. You learned about the hash variable %hash, and how to look up a value using hash access $hash{'key'}. You also learned how to delete keys from the hash, and how to process each element of a hash using a foreach loop and the keys function. We finished up with some discussion about the split function, and you learned about a few more patterns for pattern matching.

The built-in functions you learned about today include (see the perlfunc man page for more details about these functions):

  • delete takes a hash key as an argument ...

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.