I assume this is the entire body of the script, and not just a snippet. I also assume you are running perl with the -i switch. If you simply modify that to be perl -i.bak ..., your issue will be solved. See perlrun.
If you have your -i switch in your hashbang, just modify it there instead.
Update: If all you are doing is appending "\n##Copyright (C) 2012 by firstName lastName\n" to the tail of the file, why are you using switches when you could just open the file for appending, and append? e.g.
use File::Copy;
for my $file (@ARGV) {
-e $file or warn("File not found: $file\n"), next;
copy($file, "$file.bak") or die "Copy failed ($file): $!";
open my $fh, '>>', $file or die "Open failed ($file): $!";
print $fh "\n##Copyright (C) 2012 by firstName lastName\n";
}
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|