|Perl: the Markov chain saw|
Append to file or create file depending on input filename.by markuhs (Scribe)
|on Nov 20, 2009 at 13:13 UTC||Need Help??|
markuhs has asked for the
wisdom of the Perl Monks concerning the following question:
I learned about three-way open and wanted to use it. Everything seemed OK. Then I encountered problems with one particular script. It opens a file and writes to it. Normally no problem. The usage, however, caused some problems.
The script is used in the following two ways:
The second is used to append the data produced by the script to the already existing data.
Hmm... Three-way open brought me from open $filehandle ">$outfile" to open $filehandle ">", $outfile" which causes the trick not to work anymore.
First take on it:
Any suggestions how to do this more elegant?
UPDATE: as per comment of bellaire (>outfile changed to ">outfile").