in reply to Capturing remote command output to a file
Capture::Tiny is also very handy for capturing output from system calls, I asked a similar question a while back and it was the best suggestion made to me then.