Hello All,
I have a small query. I have a input file z.txt and then i would edit some lines in this file and I would make the changes and save the output file as t.txt. So finally i should be having only one file t.txt in my directory and no z.txt. Is there any better option to make this code better.
Regards,
Ramesh
I have a small query. I have a input file z.txt and then i would edit some lines in this file and I would make the changes and save the output file as t.txt. So finally i should be having only one file t.txt in my directory and no z.txt. Is there any better option to make this code better.
Code:
#!/usr/bin/perl
use warnings;
use strict;
open (IN,'+<','z.txt');
open OUT,"+> t.txt";
while (<IN>) {
s/(\d+)/40 + $1/ge;
print OUT;
}
close IN;
close OUT;
unlink ('z.txt');
Ramesh
Comment