You will find the answer from perldoc perldoc:open
In reply to Re: rerouting STDOUT by vinoth.ree in thread rerouting STDOUT by Anonymous Monk