Storable



examples/references/storable_store.pl
#!/usr/bin/perl
use strict;
use warnings;

use Storable qw(store);

my $data_structure = {
    phones => {
        Foo     => 123, 
        Bar     => 345,
        Baz     => 678,
    }
};

store $data_structure, 'frozen.data' or die;

creates a binary file


examples/references/storable_retrieve.pl
#!/usr/bin/perl
use strict;
use warnings;

use Storable qw(retrieve);

my $data = retrieve 'frozen.data' or die;
print "Foo: $data->{phones}{Foo}\n"; # Foo: 123
print "Bar: $data->{phones}{Bar}\n"; # Bar: 345
print "Baz: $data->{phones}{Baz}\n"; # Baz: 678