I'm trying to read and write to a file at the same time.
I used open ( FILE, +<$file_name) to make $file_name both readable and writeable.
I basically want to replace
x
y
z
in the file
with
x
a
y
z
When I tried doing this with an algorithm that works like this
if $line = /x/
print FILE a;
This did not work
How do I do this?.
Thanks in advance,
I used open ( FILE, +<$file_name) to make $file_name both readable and writeable.
I basically want to replace
x
y
z
in the file
with
x
a
y
z
When I tried doing this with an algorithm that works like this
if $line = /x/
print FILE a;
This did not work
How do I do this?.
Thanks in advance,