sub initThreads{ my @initThreads; for(my $i = 1;$i<=$num_of_threads;$i++){ push(@initThreads,$i); } return @initThreads; } # use the initThreads subroutine to create an array of threads. my @threads = initThreads(); #### $hash1{$affix}{$postfix} = threads::shared::shared_clone([$affix1]); This is where the problem is. How can I assign an array to a hash of hash #### $hash1{ $affix } { $postfix } = ...; #................^^^^^^^^^^^^ #### $hash1{ $affix } = &share( {} ); ## Add an empty shared hash ## THEN you can do $hash1{ $affix }{ $postfix } = .... #### ..................... threads::shared::shared_clone( [ $affix1 ] );