in reply to Saving my output to a folder
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.my $output = <STDOUT>; print STDOUT "$input";
You need to open a file handle for output like this:
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.open OUT, '>', 'c:/users/lastgen/docs/saved_ppid' or die "unable to open out file $!"; print OUT "something";
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Saving my output to a folder
by LastGen Monk (Novice) on Apr 19, 2016 at 20:11 UTC | |
by Marshall (Canon) on Apr 20, 2016 at 04:46 UTC |