# “Cache the data for other uses!”

## dbmopen(%price_cache, "price_cache", 0644) or die …;

##

## while ($line = <COST>) {

## . . .

## write; # using format with $prod, $cost and $note

##

## $price_cache{$prod} = "$cost $note";

## }

Previous slide | Next slide | Back to first slide | View graphic version

Notes:

The company grows and now stocks thousands of products.

To save time the derived price for each product can be saved in a simple DBM' database (support for which is built into perl) and made available to other perl programs.

Just two additional lines of code is all that's needed.

(A similar pair of lines is all that's needed to read the data.)