in reply to Append to file or create file depending on input filename.
That is, if the substitution succeeds, it should return a true value (the number of things replaced, at least 1), and you get '>>' for your mode at the same time that you fix your outfile namae. Otherwise you get '>' for your mode. I wasn't sure about the evaluation happening in the right order, but I tested it and it seems to work. :)open($filehandle, (($outfile =~ s/\A>//xms) ? '>>' : '>'), $outfile);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Append to file or create file depending on input filename.
by moritz (Cardinal) on Nov 20, 2009 at 14:14 UTC | |
by markuhs (Scribe) on Nov 20, 2009 at 15:10 UTC | |
|
Re^2: Append to file or create file depending on input filename.
by graff (Chancellor) on Nov 20, 2009 at 23:24 UTC | |
by bellaire (Hermit) on Nov 21, 2009 at 13:08 UTC |