rovf:
I think that the problem you're having is that the perl executable doesn't manage I/O redirection. Normally that's handled by the shell. So the command you're giving doesn't actually try to redirect STDOUT and STDERR--instead it's just passing ">out.txt" and "2>&1" as arguments to the myProg.pl script.
Why not simply add command-line options to myProg.pl to have alternate output streams? Then you don't have to detect redirection--you just tell myProg where to send the output.
...roboticus
In reply to Re: Test whether STDOUT is connected to a file
by roboticus
in thread Test whether STDOUT is connected to a file
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |