Exercise: A Free-Form Memo Pad

Now that you have an easy way to keep data on the disk, it's time to put it to good use. This exercise presents a free-form memo pad that keeps information based on keys and allows you to search and retrieve that information with simple queries.

A sample session with the program (called memopad) is shown in Listing 15.1.

To query the memopad program, simply type the name of a topic, followed by a question mark. To program in a new fact, type a phrase in the form “X is Y”, where X is the topic and Y is the information to associate with that topic. You can search the database for similarities by typing “like pattern?” where pattern is a regular expression to search for in the topics. All topics matching that expression ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD 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.