my @threads = (); for(0..4) { $threads[$_] = threads->create(\&func) } for(@threads) { $_->join }