> -----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";

When you open a file in append mode, the pointer is positioned
at the end prior to all writes, no matter what you do with
seek(). But that's not the whole story.

For more details, read the FAQ article:

perldoc -q 'insert a line'

> 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