herby1620 has asked for the wisdom of the Perl Monks concerning the following question:

Well, now I've done it. I've got a perl script that calls another script (it doesn't matter what language, but perl works). If I open up a command window (I'm using XP) and say:
The script executes wonderfully, and I get ALL the output of the original script ("" in this case) and the programs that the script runs. If I attempt to re-direct the output of the script like:
C:> >log_file.txt
The only thing written to the output file is the output generated by the original script (""). The output of the decendants (system...) of "" just disappear! Now for the 'wierdness'. If I say:
C:> perl >log_file.txt
at the command line, the log file will receive all the text written by the script, and its decendants, which is the same output generated by the first example. The big question: HUH? Why does it behave differently if invoked in the various ways? In my Unix background this wouldn't be different (I'll let others verify my error if not!). I show the code for "" for reference:
#!/usr/bin/perl -w if (!defined $ARGV[0]) {$ARGV[0] = 3}; print "Argv[0] is $ARGV[0] \n"; print "Just a line to see what happens\n"; # Just to make it fun $less = $ARGV[0] - 1; if ($less) { print "Call with one less: $less \n"; system (" $less"); print "System returned $? (not that I care!)\n"; }
Yes, this is a bit silly, but it demonstrates my point. I am running on windows (XP), so forgive me. Thanks.