C
cindyybl
I am trying to edit a file in my perl program. Basically, the operation
is to substitute one line in that file. But I thought that file
read/write is too complicated and tedious for a simple task like this.
There is a one-liner to substitute text in selected file on command
line. And this is
perl -pi -e "s/pattern1/pattern2/g" filename
Well, I can always use back tick to exec this line in my program, but
is there a simple piece of perl code that will just do the same as that
in a perl program?
Thanks.
is to substitute one line in that file. But I thought that file
read/write is too complicated and tedious for a simple task like this.
There is a one-liner to substitute text in selected file on command
line. And this is
perl -pi -e "s/pattern1/pattern2/g" filename
Well, I can always use back tick to exec this line in my program, but
is there a simple piece of perl code that will just do the same as that
in a perl program?
Thanks.