in reply to Re: launching external program with SYSTEM causes script to hang until program closed
in thread launching external program with SYSTEM causes script to hang until program closed

I have had good success with fork on Windows (perl release 5.6+). However, you can also use a piped open command which will not wait for the output. If the trailing character is a pipe symbol, "open" launches a new process with a read-only filehandle connected to it. For example:
open(NET, "netstat -i -n |") or die "can't fork: $!"; # You could go off and do other things here for a bit, # and then come back to check on your results. while (<NET>) { # your code here... } close(NET) or die "can't close netstat: $!/$?";
Please note that when you explictly close the piped filehandle, it will cause the parent process to wait for the child to finish (and I recommend closing it).
  • Comment on Re^2: launching external program with SYSTEM causes script to hang until program closed
  • Download Code