How should I update a hash of hashes when using multi-threading in Perl?
I have been spending the last hours trying to figure this out and now I'm really confused.

This is the outline of my task. I should write a Perl subroutine that gets a reference to a hash of hashes.

I have another sub (`helper`) that gets a single inner hash and does some stuff to with, including adding keys.

    sub helper {
     $href = shift;
     $href->{NEW_KEY}=1;
    }



Since each of the internal hashes is independent of the others, I would like to use multi-threading to call `helper`.

I'm using `Thread::Pool::Simple' which almost lacks any documentation. 'Thread::Pool' is not supported by my Perl version.

So I have something like this:

       sub my_sub {
        $hohref = shift;       
    
        # create thread pool
    	my $pool = Thread::Pool::Simple->new(
    		do  => [ \&helper ]
    	);
    
    	# submit jobs
    	foreach my $hashref ( values %{$hohref} ) {
    		$pool->add( $hashref );
    	}
    
    	# wait for all threads to end
    	$pool->join();
        }

The key point is that I would like the main hash of hashes to reflect all the changes made to the inner hashes.

`my_sub` gets an unshared reference  (to $hohref) so I tried creating a shared copy in the body of `my_sub`: 

    my $shared_hohref = shared_clone $hohref;

use it and return it instead, but still, the internal hashes were not updated.

When I use the exact same code, but simply replace all the thread pool block with a simple loop

	foreach my $hashref ( values %{$hohref} ) {
		helper( $hashref );
	}

then everything works fine.

Your help would be greatly appreciated.
How should I update a hash of hashes when using multi-threading in Perl?
===

I have been spending the last hours trying to figure this out and now I'm really confused.

This is the outline of my task. I should write a Perl subroutine that gets a reference to a hash of hashes.

I have another sub (`helper`) that gets a single inner hash and does some stuff to with, including adding keys.

    sub helper {
     $href = shift;
     $href->{NEW_KEY}=1;
    }



Since each of the internal hashes is independent of the others, I would like to use multi-threading to call `helper`.

I'm using `Thread::Pool::Simple' which almost lacks any documentation. 'Thread::Pool' is not supported by my Perl version.

So I have something like this:

       sub my_sub {
        $hohref = shift;       
    
        # create thread pool
    	my $pool = Thread::Pool::Simple->new(
    		do  => [ \&helper ]
    	);
    
    	# submit jobs
    	foreach my $hashref ( values %{$hohref} ) {
    		$pool->add( $hashref );
    	}
    
    	# wait for all threads to end
    	$pool->join();
        }

The key point is that I would like the main hash of hashes to reflect all the changes made to the inner hashes.

`my_sub` gets an unshared reference  (to $hohref) so I tried creating a shared copy in the body of `my_sub`: 

    my $shared_hohref = shared_clone $hohref;

use it and return it instead, but still, the internal hashes were not updated.

When I use the exact same code, but simply replace all the thread pool block with a simple loop

	foreach my $hashref ( values %{$hohref} ) {
		helper( $hashref );
	}

then everything works fine.

Your help would be greatly appreciated.