in reply to redirect all output

You can duplicate STDOUT and then reopen STDOUT to something else.

open my $stdout, '>&STDOUT' or die $!; open STDOUT, '>', $file or die $!;
Now everything printed to STDOUT ends up in the file given by $file. If you want to print to the original STDOUT you can do that by doing print $stdout 'hello';.

See perlopentut for more on this.

ihb

See perltoc if you don't know which perldoc to read!