while(my $job = get_next_job()) { my $run_path = $job->get_run_path(); open STDERR, '>', "$run_path/stderr.txt" or die; open STDOUT, '>', "$run_path/stdout.txt" or die; $job->run(); open STDERR, '>', '/dev/null'; open STDOUT, '>', '/dev/null'; # Do some other job cleanup/notification stuff that may # output to STDERR/STDOUT but I don't want in the # individual job log files do_some_other_stuff_before_going_to_next_job(); }