http://www.perlmonks.org?node_id=75030


in reply to Output of a forked process

exec does not work like that, you want system

Quote from exec
The exec() function executes a system command AND NEVER RETURNS - use system() instead of exec() if you want it to return. It fails and returns FALSE only if the command does not exist and it is executed directly instead of via your system's command shell (see below).

Have a look at exec more details are there.