Perl module: Storable
Main functions:
store
retrieve
Exporting or storing a perl object, variable, module, or anydata that needs to stay between runs is easy. You just need to include a simple module and will gain access to two major functions. The function for storing is store.
use Storable;
# build object here. No sense in storing an empty object
store \$scalar, 'file';
store \@array, 'file';
store \%hash, 'file';
store \$object, 'file';
Importing or retrieving a perl object, variable, module, or what you previously stored is easy.
use Storable;
# object will be overwritten on load, if necessary.
my $scalar = retrieve 'file';
my @array = @{retrieve 'file'};
my %hash = %{retrieve 'file'};
my $object = retrieve 'file';
# add information to object here
Note: When storing an object, the file will be overwritten. You can either combine multiple object into a single hash or you can use multiple files if needed.