Writing at exact location in file

R

rahulthathoo

Hi
I want to write to a file - which already exits and has some
data in it. I dont want to erase that data. Say suppose it has 30
lines of text in it. I want to write something in the first line after
the first two words. How do i go about it. I know how to open a file
but I am not able to seek to the right position and not able to write
my text without deleting the entire data of the file but i dont want
that. Can you help me here.

Thanks
Rahul
 
M

Mumia W. (reading news)

Hi
I want to write to a file - which already exits and has some
data in it. I dont want to erase that data. Say suppose it has 30
lines of text in it. I want to write something in the first line after
the first two words. How do i go about it. I know how to open a file
but I am not able to seek to the right position and not able to write
my text without deleting the entire data of the file but i dont want
that. Can you help me here.

Thanks
Rahul

The module Tie::File will let you treat a file as an array in Perl.

Start->Run->"perldoc Tie::File"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top