in reply to submitting job to a queue

Do you mean that your perl script actually quits when system is called, and you never reach your "if" statement?

If the qsub you are referring to is the SGE submission command, then I can think of a couple of potential solutions. I do not have much experience with SGE, but when I google qsub, and search for "wait", I see the "-sync" option, which states:

-sync y[es]|n[o] Available for qsub. -sync y causes qsub to wait for the job to complete before exiting. ...

Another possibility is to submit the job as you are doing, then wait for the job to finish by polling its status using qstat.

Replies are listed 'Best First'.
Re^2: submitting job to a queue
by mjr1n1 (Initiate) on Jul 10, 2008 at 14:31 UTC
    No, qsub submits the job correctly and the job starts as well and runs in the background. But, the moment job gets submitted and before the job is finished, it comes back to the next statement in perl (e.g. "if" statement) and executes it and then exits the perl program. I need the perl program to just wait after submitting the qsub job and till it is finished, and then go to the next statement (i.e. "if" statement) thanks..
      I know this was posted a long time ago but I came across the same problem and in case it might help someone else, I solved it by using the "-W block=true" qsub option for PBS systems(i think the problem arises because "the qsub command exits after returning the ID of the new job" and not after completing the task)