Hi,
I am modifying an existing perl script to basically insert a statement
as the 3rd sentence of a file(so the existing 3rd sentence of the file
would become the 4th sentence). I've looked at some FAQs on the
perldoc.com site and managed to get started. However, I am only able to
insert this statement at the top of the file and then everything else
within the file is overwritten.
I am pasting the segment of the perl code that I added. The statement
that I want to insert is the "Integrator" statement. This might be very
easy for most of you. I am not a programmer by any standard and never
used Perl. So, thanks in advance for your help.
My code goes like this.....
$old = "$LeafPreName.acf";
$new = "$old".".tmp";
$bak = "$old".".orig";
open(OLD, "<$old");
open(NEW, ">$new");
while (<>) {
if ($. == 3) {
print NEW "INTEGRATOR/ ERROR=5.0E-2, HINIT=2.5E-4,HMAX=2.5E-4,
KMAX=6, MAXIT=10\n";
}
}
close(OLD);
close(NEW);
rename($old,$bak);
rename($new,$old);
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]