O'Reilly logo

Sams Teach Yourself Perl in 21 Days, Second Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required