perl -w my_program.pl > my_output.txt
如果你还想包含stderr输出,那么你可以这样做(假设你的shell是bash):
perl -w my_program.pl &> my_output.txt