Take a look at IPC::Open3. It will do exactly what you want.
After Compline,Zaxo
In reply to Re: output from an external program by Zaxo in thread output from an external program by olecs