Help for this page
open(FOO,">/temp/foo") || die $!; sub foo { local *STDOUT=*FOO; print "foo"; } #yes, this is supposedly +to STDOUT foo; close(FOO);
*FOO=*STDOUT; #Save it somehow open(STDOUT,">>outputfile") || die $!; sub foo { print "foo bar"; } foo; close(STDOUT); *STDOUT=*FOO;