in reply to redirect all output

open STDOUT,">","some_file.txt" or die "Can't redirect STDOUT: $!"
See also perlopentut