in reply to redirect all output

What I would do is:

open my $hold, '>&', STDOUT or die "Failed to dup STDOUT\n"; open STDOUT, '>', 'output.txt' or die "Failed to re-open STDOUT\n"; # later, if you want to restore STDOUT: open STDOUT, '>&', $hold or die "Failed to restore STDOUT\n";
The only line you really need is the second open. The first and the third opens are there only in case you want to restore STDOUT to its original state.

the lowliest monk