use Proc::Queue size => 2, delay => 3.0, qw(system_back); foreach(@temp_files) { system_back("$program < $_"); } 1 while wait != -1;