use File::Tee qw(tee); tee(STDOUT, '>', "foo/bar.out"); tee(STDERR, '>>', "foo/bar.err");