in reply to storing data in a package/module

I would use Exporter and create accessors for the data rather than accessing the data directly.

package Foo; use warnings; use strict; use base 'Exporter'; our @EXPORT_OK = qw( some_data some_more_data fribble ); sub some_data { 'foo' } sub some_more_data { 'bar' } my %gnarfles = ( this => 1, that => 'one' ); sub fribble { my $key = shift; if (exists $gnarfles{$key}) { return $gnarfles{$key}; } else { die "No such value ($key)"; } } 1;

And in your actual program:

use Foo qw'fribble some_data'; my $result = fribble($key);

By properly encapsulating your data in accessors, you make it much easier to extend and make it easier to validate. Also, by adding it to @EXPORT_OK instead of @EXPORT, you ensure that people only import the functions that they need and, more importantly, it is very easy to track down where the function came from.

Cheers,
Ovid

New address of my CGI Course.