Not what you asked for, but re the backup files lack of usefulness, you might consider using a flag to indicate that a particular file has or has not already been changed... and use the value of that flag to determine whether to rename the file being changed to -- say -- file.old, if you're making the first change of this run or to .bak, on subsequent encounters with the same file.
Alternately, you could make your sub do a rename to file.(OPTIONAL: time_of_action).old, unless the particular file.old exists already, in which case, it should rename to file.bak.
The second notion is probably simpler to implement, but will rely on good housekeeping. I gather you want to be able to compare or diff the original with the revisions after this snippet completes, but then, immediately, you have to unlink or del the .olds, because failing to do so will bork the logic on the next run (which might even be before your first is finished in a multi-user environment).
In reply to Re: Perl File Editing Subroutines, Any ideas?
by ww
in thread Perl File Editing Subroutines, Any ideas?
by symgryph
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |