I could be wrong but I don't believe seek will help anyway.  I would think
that if you did get the file pointer where you want it, and then started
printing, that you would only overwrite the rest of the file. I assume that
isn't what you intend.

If you want to try anyway, you will need to open the file for both read and
write with "+<", not ">>" which is append (see "perldoc -f open" for
details).

In the end you most likely will want read the file into a variable first,
add your extra text, then overwrite the current file.

Rob

-----Original Message-----
From: lz [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 3:19 PM
To: [EMAIL PROTECTED]
Subject: inserting in the middle of the file


Hi guys,

I recieve an email in the following format:
Dear Name,
yara
yara
yars

I need to insert a paragraph, right after word Dear
Name, e.g.
Dear Name,
NEW_PARAGRAPH
yara
yara

I am trying to use seek, but it doesn't work for some
reason:
open(ORIG_FILE, ">>$origFile") or die "cannot append";
seek(ORIG_FILE, 2, 0) or die "cannot seek";
print ORIG_FILE "New paragraph. ";
.....
Does anyone know whats wrong with the above code?

Thank you!

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to