in reply to Find and Replace
so here's what I've come up with. any suggestions for debugging this script?
use strict; use warnings; use Fcntl qw(:flock :seek); my($fileName) = $ARGV[0]; print("$fileName \n"); #open the file and copy to an array open(INFILE, $ARGV[0]) || die("Cannot Open File"); my(@aFile) = <INFILE>; close(INFILE); # Delete line 6 splice(@aFile,5) || die("Line 6 is already deleted"); open(OUTFILE,">$fileName") || die("Cannot Open File"); flock(OUTFILE, LOCK_EX); seek(OUTFILE, 0, SEEK_SET); print OUTFILE @aFile; print OUTFILE "<APPLICATION APP_FILE_PATH=\"xxxxxx" CONFIG_FILES=\"xxx +x/$fileName, MISC_FILES=\"\" LOG_FILE_DIRECTORY=\"\" OVERRIDES_DIRECT +ORY=\"\" CONTACTS_DIRECTORY=\"\" LICENSE_DIRECTORY=\"\"/>"; close(OUTFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find and Replace
by GrandFather (Saint) on Mar 25, 2010 at 23:14 UTC |