You might consider using Proc::Background, which specializes in running other processes platform-independently (with emphasis on windows), and gives you an object to monitor and kill it. Then you can also write the rest of the script to periodically check for the case of when bittorrent needs restarted, and not be blocked by waiting for system().