I have a script that opens an executable as a file handle ie: $pid = open(PRG, "| my.exe"); The script sends query commands, analyzes the output, and does some stuff if it finds something it doesn't like. Here's my problem, I run the script as an NT service when I stop the service the perl.exe stops but "my.exe" keeps on going. I have an exitGracefully sub routine that will stop "my.exe" cleanly, but I can't figure out how to call that sub when the script dies. I've tried using END blocks and sigtrap. Has anyone been able to accomplish this in NT?