How to redirect console output to a text file
command-line, perl
Solution
The preferred method for this is to handle redirection via the command line, e.g.
perl -w my_program.pl > my_output.txt
If you want to also include stderr output then you can do this (assuming your shell is bash):
perl -w my_program.pl &> my_output.txt
Problem
I am executing a Perl program. Whatever is being printed on my console, I want to redirect that to a text file.