title: How to get around SYSTEM (fork-wait) in perl?
body: <p>I am using the SYSTEM command in perl to launch a Linux system command and I've run into an issue. From the perldocs describing the SYSTEM command it appears that SYSTEM does a Fork-Wait around the system command call. Unfortunately, if the system command hangs up, the Perl program does too. Below is an example of the system command:</p>
  
  <pre><code>system("bjobs -w -r |grep -v GLS | grep -v JOBID   &gt; $bjoblistfile");
  </code></pre>
  
  <p>However, every once in a while the "bjobs" command hangs so this system command does not return.</p>
  
  <p>Is there a way to use the SYSTEM command to "fork-wait" with a timeout option?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Mark</p>