Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The DBIx::Table2Hash module provides a simple way to turn a database table into a hash, turning SQL statements into simple lookups in a prepopulated table. DBIx::Table2Hash has methods to make this data available in a nested form as well as in a one-dimensional lookup table. While it doesn't allow for updates, it provides fast, convenient access to the data of a static table, such as a table containing postal codes and the cities to which they map. For this example, assume a simple table that looks like this (using SQLite again):
CREATE TABLE postal_code (
code VARCHAR PRIMARY KEY,
city VARCHAR
);