in reply to Redirect STDOUT to textfile?

File manipulation starts with the open() command, so start by reading the documentation

perldoc -f open

and then search down for the words

Here is a script that saves, redirects, and restores "STDOUT" and "STDERR" using various methods: