#!/usr/bin/perl
use strict;
use warnings;
my %hsh = ( Apple=>1, Banana=>7, Cherry=>42 );
my $txt = "The quick red fox jumped over the lazy brown dog";
my @ary = (17, 'Flugelhorn', 13.333);
use Storable qw( nstore_fd );
open my $SF, '>', 'tst_Storable.db' or die "Error: $!\n";
nstore_fd \%hsh, $SF;
nstore_fd \$txt, $SF;
nstore_fd \@ary, $SF;
close $SF;
####
#!/usr/bin/perl
use strict;
use warnings;
my %hsh;
my $txt;
my @ary;
use Storable qw( fd_retrieve );
open my $SF, '+<', 'tst_Storable.db' or die "Error: $!\n";
%hsh = (%{fd_retrieve $SF});
$txt = ${fd_retrieve $SF};
@ary = @{fd_retrieve $SF};
close $SF;
print "Text: '$txt'\n";
print "Array: (", join(', ', @ary), ")\n";
print "Hash: (", join(', ', map { "$_=>$hsh{$_}" } keys %hsh), ")\n";
####
roboticus@Boink:~
$ perl tst_Storable_2.pl
Text: 'The quick red fox jumped over the lazy brown dog'
Array: (17, Flugelhorn, 13.333)
Hash: (Cherry=>42, Banana=>7, Apple=>1)