Hello,
Company policy prevents me from posting any code. I'm writing a script to automate a series of tasks to be run on a windows XP machine. The script needs to call 4 other scripts. I've had no problem calling the other scripts, however I ran into a snag when it comes to their output. Each of the four scripts outputs to their own respective default locations. For example, scriptA.pl will output its many files to a folder called scriptA, and scriptB.pl will output another 2,000 files to the folder scriptB in another location, etc. I'd like to redirect these output files to a specified location to be hard-coded into the calling script. I also need to redirect all STDERR to a log file. I haven't decided on the final location, but it may be something such as C:\Results.

I've looked through the perl manuals and FAQs as well as this site for examples, but nothing I've found seems to be the same as what I'm trying to achieve. I did manage to redirect the called programs' STDERR, but can' seem to get the rest working. I'm using the system() function to call each script (I used system in order to make sure the program(s) is called correctly). I can't use any CPAN modules because there's no guarantee that any such module will exist on the machine that will run the scripts. Thanks in advance.

In reply to Output redirection by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.