title: Showing progress whilst running a system() command in Perl
body: <p>I have a Perl script which performs some tasks, one of which is to call a <code>system</code> command to <code>"tar -cvf file.tar....."</code>.</p>
  
  <p>This can often take some time so I'd like the command line to echo back a progress indicator, something like a <code>#</code> echoing back to screen whilst the <code>system</code> call is in progress.</p>
  
  <p>I've been doing some digging around and stumbled across <code>fork</code>. Is this the best way to go?   Is it possible to fork off the <code>system</code> command, then create a while loop which checks on the staus of the <code>$pid</code> returned by the fork?</p>
  
  <p>I've also seen references to <code>waitpid</code>.... I'm guessing I need to use this also.</p>
  
  <pre><code>fork system("tar ... ")
  while ( forked process is still active) {
      print #
      sleep 1
  }
  </code></pre>
  
  <p>Am I barking up the wrong tree?</p>
  
  <p>Many thanks
  John</p>