This part,
my $output = <STDOUT>; print STDOUT "$input";
is not right. You are trying to read from the output! And print goes by default to STDOUT which in this case is the terminal.

You need to open a file handle for output like this:

open OUT, '>', 'c:/users/lastgen/docs/saved_ppid' or die "unable to open out file $!"; print OUT "something";
Note that I used "forward slash" instead of "back slash" in the path name. This is completely fine on Windows and will save yourself a lot of pain because "\" means something very special in Perl.

Update: If c:/users/lastgen/docs/saved_ppid is a directory then of course you need a target file like: c:/users/lastgen/docs/saved_ppid/ppid.txt. I see stevieb posted while I was typing. That code shows the preferred way for a file handle, using a lexical variable ($wfh) instead of what I did, a bare word (OUT). I did it that way because it might be easier for you to get started with and look at bit more obvious.


In reply to Re: Saving my output to a folder by Marshall
in thread Saving my output to a folder by LastGen 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.