Another Example: A Database of Artists and Their Works
Nested data structures work best for representing complex sets of data and allow you to do various things with that data. In this example, then, we'll look at a database of artists, some information about those artists, and their various works. To save space, we'll keep this example short. All this example does is
Read the artist data from a file into a complex nested data structure
Prompt for a search string
Print the data for that particular artist, given that search string
The data we'll look at in this example consists of an artist's first and last names, their birth and death dates, and a list of titles of their works. The artist's data is stored in an external file consisting of two lines ...
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.