foreach my $key ( keys %$work ) { my $cap_run = $work->{ $key }->{ captured_run_name }; my $status = $work->{ $key }->{ statuscode }; push( @threads, threads->create( sub{ sleep 10; print "in thread"; return 1; }, $key, $cap_run, $status ) ); } foreach my $thr ( @threads ) { push( @results, $thr->join ); }