use strict; use warnings; use Parallel::ForkManager; use File::Temp qw(tempdir tempfile); my $pm=new Parallel::ForkManager(15); my $tempdir = tempdir(); for my $i (1..15) { $pm->start and next; # srand($$); my $fh = File::Temp->new(TEMPLATE => "sappyXXXXXXXX", UNLINK => 0) or die "Could not make tempfile: $!"; close $fh or die "Could not close tempfile: $!"; $pm->finish(); } $pm->wait_all_children;