Chapter 16. Perl

One of the most useful functions of a database is allowing regular reports to be created that reflect important trends that a user wants to track. For example, a business might be interested in the relative increase in sales that can be directly attributed to a television advertising campain; similarly, a university academic might be interested in identifying the exam questions on which students struggle. Report generation is best automated in a program that issues SQL statements and summarizes and formats the results into something easier to digest. You can create powerful tools that allow users to interact with the data, and also to interchange data with applications such as statistical analysis tools.

A general-purpose client such as the MySQL monitor allows you to execute any SQL query you like. However, most applications use only a limited set of SQL queries to add data to a database, modify existing data, or list data, so you can write a custom client to perform these frequent queries.

Perl has been a hugely popular scripting language since its first release in 1987; while newer languages such as PHP, Python, and Ruby have appeared since then, Perl remains very popular. Perl is very flexible; in fact, the Perl motto is, There’s more than one way to do it, often mentioned as the acronym TMTOWTDI.

Perl is also one of the most portable languages, with support available on a large number of operating systems, including the three that we focus on in this book. This ...

Get Learning MySQL 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.