Configure the grid engine to receive a batch of jobs foreach job @jobs{ Submit job } #### #Job.sh read arg while [ arg != TERMINATE ] do (submit job arg) read arg done #### #SubmitJob.pl use strict; use warnings; my @jobs; # do some stuff here... ... # run the shell script `./Job.sh`; # generate the jobs.. @jobs=... # print the jobs to STDOUT so that they can be picked up by the shell script: foreach my $job (@jobs){ print $job; } exit 0;