lock(%cfg::thash);
$v1="A";
$v2="1";
$cfg::thash{$v1}{$v2} ="b";
####
$cfg::thash{$v1}{$v2} ="b";
####
## Make the value of key 'A' an anonymous hash.
$cfg::thash{A} = {};
## add a key '1' to that anonymous hash with the value "b";
$cfg::thash{A}{1} = "b";
####
use strict;
use threads;
use threads::shared;
my %thash : shared; ## Share the base hash
my $temp = {}; ## Get a reference to an anon. hash in a temp var
share( $temp ); ## share() the temp var
$thash{A} = $temp; ## assign it into the structure
$thash{A}{1} = 'b'; ## At this point you have what you asked for.