in reply to Append to file or create file depending on input filename.
The perl script doesn't have to bother opening a specific output file at all; it just prints. (STDOUT is the default output file handle.) Plus, no more worries over forgetting to include quotes on the command line -- just let the shell do what it's supposed to do.perl script.pl > outfile # create new or truncate existing outfile perl script.pl >> outfile # create new or append to existing outfil +e
That also allows you to use the script in yet another handy way (and the last time I checked, the "standard" windows cmd.exe handles all three modes the same way unix and linux do - it's portable!):
That's what we call elegant.perl script.pl | some_other_process ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Append to file or create file depending on input filename.
by markuhs (Scribe) on Nov 23, 2009 at 10:46 UTC | |
by graff (Chancellor) on Nov 24, 2009 at 04:22 UTC |