S
Steve Hémond
Hi all,
I have to replace some chuncks out of a text file. My actual way to do this
is to put the file contents into a scalar variable :
open (INPUT, "$ARGV[0]") or die ("Can't open file : $!\n");
$in = <INPUT>;
close INPUT;
Then I do my modifications to the file and I (must) write the replacements
into another file :
open (OUTPUT, ">$ARGV[1]") or die ("Can't create file : $!\n");
seek (OUTPUT,0,0);
print (OUTPUT $in);
close OUTPUT;
That way, I must save the replacements to ANOTHER file, which I don't want.
I would like to modify the file DIRECTLY. Since I cannot modify the file
using the file handle like this :
<INPUT> = s/blahblah/blah2blah2/g
How could I modify the file directly?
Thanks in advance,
Steve
I have to replace some chuncks out of a text file. My actual way to do this
is to put the file contents into a scalar variable :
open (INPUT, "$ARGV[0]") or die ("Can't open file : $!\n");
$in = <INPUT>;
close INPUT;
Then I do my modifications to the file and I (must) write the replacements
into another file :
open (OUTPUT, ">$ARGV[1]") or die ("Can't create file : $!\n");
seek (OUTPUT,0,0);
print (OUTPUT $in);
close OUTPUT;
That way, I must save the replacements to ANOTHER file, which I don't want.
I would like to modify the file DIRECTLY. Since I cannot modify the file
using the file handle like this :
<INPUT> = s/blahblah/blah2blah2/g
How could I modify the file directly?
Thanks in advance,
Steve