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(); }