Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: how do i redirect STDOUT, STDIN, or STDERR to a FILE?

by mr.nick (Chaplain)
on Dec 28, 2011 at 17:48 UTC ( [id://945384] : note . print w/replies, xml ) Need Help??


in reply to how do i redirect STDOUT, STDIN, or STDERR to a FILE?

open STDERR,">","stderr.log" or die $!; open STDOUT,">","stdout.log" or die $!;
It's a bit more clear and obvious. Redirecting STDIN *to* a file makes no sense, but I suppose you could do:
open STDIN,"<","stdin.txt" or die $!; print while <>;
But I'm not sure what the purpose of that would be.

mr.nick ...