jaffinito34 has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a script that opens all files passed in on the command line. Then it'll save a copy with a ".bak" extension and modify the file to add a copyright at the end. Here's what I have so far:
chomp(my @lines = <>); foreach $line(@lines){ print $line."\n"; } print "\n"; print "##Copyright (C) 2012 by firstName lastName\n";
The code so far will open the files passed thru on the command line (I'm just using a txt file for now), prints the file, and then adds the copyright at the end. I can't find anything on how to save a copy of this as a ".bak". Any help or reference to helpful material is appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: copying a file with .bak extension
by kennethk (Abbot) on Nov 07, 2012 at 18:27 UTC | |
by jaffinito34 (Acolyte) on Nov 07, 2012 at 19:32 UTC | |
by kennethk (Abbot) on Nov 07, 2012 at 20:37 UTC | |
|
Re: copying a file with .bak extension
by sanbeg (Novice) on Nov 07, 2012 at 18:22 UTC | |
by Anonymous Monk on Nov 07, 2012 at 18:43 UTC | |
by jaffinito34 (Acolyte) on Nov 07, 2012 at 18:37 UTC | |
by Lotus1 (Vicar) on Nov 07, 2012 at 19:20 UTC | |
|
Re: copying a file with .bak extension
by Lotus1 (Vicar) on Nov 07, 2012 at 19:06 UTC | |
by Anonymous Monk on Nov 07, 2012 at 19:20 UTC | |
by Lotus1 (Vicar) on Nov 07, 2012 at 19:46 UTC |