I have a strange error that occurs in code I wrote. I'm trying to redirect STDOUT and STDERR to a log file. When I run the program, sometimes it works and sometimes I continue to get STDOUT to the screen in addition to the log file. I don't change the code. I just re-run the program and I get different results each time. Here's how I redirected the output. If someone knows why this would be happening, please let me know.
warn "QUIET MODE: Program operations and errors are being redirected t +o the file arbol.log\n"; close (STDERR); open (STDERR, "> ".$outpath."/arbol.log"); open (NEW_OUT, ">&STDOUT"); open (STDOUT, ">&STDERR");
In reply to Redirecting output by carsonholt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |