This sounds like data sharing, for which I'd use JSON (it's cross-language).
I've included an example script that shows you how you write JSON to a file called write.pl.
I then show the resulting JSON data in the file, then a script fetch_hash.pl that reads in the data using a command line argument.
write.pl
use warnings;
use strict;
use JSON;
my %first_hash = (fruit => 'banana', Vegetable => 'tomato');
my %second_hash = (work => 'office', family => 'home');
my %hashes = (
first_hash => \%first_hash,
second_hash => \%second_hash,
);
my $json = encode_json \%hashes;
open my $fh, '>', 'data.json' or die $!;
print $fh $json;
data.json (JSON file)
{"second_hash":{"work":"office","family":"home"},"first_hash":{"Vegeta
+ble":"tomato","fruit":"banana"}}
fetch_hash.pl
use warnings;
use strict;
use Data::Dumper;
use JSON;
if (! @ARGV && ($ARGV[0] ne 'first_hash' || $ARGV[0] ne 'second_hash')
+){
print "need first_hash or second_hash as arg\n";
exit;
}
my $want = $ARGV[0];
my $file = 'data.json';
my $json;
{
local $/;
open my $fh, '<', $file or die $!;
$json = <$fh>;
close $fh;
}
my $data = decode_json $json;
print Dumper $data->{$want};
Output:
$ perl fetch_hash.pl first_hash
$VAR1 = {
'fruit' => 'banana',
'Vegetable' => 'tomato'
};
$ perl fetch_hash.pl second_hash
$VAR1 = {
'work' => 'office',
'family' => 'home'
};