our %planets : shared; our $response = SomeClass::TCP_IP_Response->new(@some_arguments); [...] lock %planets; if (exists $planets{$some_id}) { lock $planets{$some_id}; $response->content($planets{$some_id}->{'data'}); $planets{$some_id}->{'atime'} = time; } else { my $data; [...] # read the serialized data from disk ## Assuming $data is a reference to a *simple*, *single-level* hash ## Copy the data into a shared equivalent; my %sharedHash :shared = %{ $data }; ## And then assign a reference to the *shared* copy. # my %el = ( 'data' => \%sharedHash, # 'atime' => time, # 'deleted' => 0, # 'modified' => 0 # ); ## But if you do this, *ALL THE CONTENTS OF %e1 WILL BE DISCARD* # $planets{$some_id} = share(%el); ## So make the local datastructure shared also my %el :shared = ( 'data' => \%sharedHash, 'atime' => time, 'deleted' => 0, 'modified' => 0 ); ## Now you do not need to use shared() ## as a reference to a shared object is shared. $planets{$some_id} = \%el; }