in reply to Re^3: questions regarding "+<"
in thread questions regarding "+<"

Dave:

"Filesystems generally don't support an insert feature. "+<" gives you read/write access. It doesn't create a "prepend" or "insert" feature. Any changes made will write over what was there before, beginning at the current position within the file." This is exactly I was looking for.

I have checked camel book, but didn't find a detailed explanation for this behavior.

Thank you.

Replies are listed 'Best First'.
Re^5: questions regarding "+<"
by davido (Cardinal) on May 15, 2014 at 20:38 UTC

    That's correct, there's not a detailed explanation in the Camel book describing that +< (which is based on fopen(3)'s "r+") overwrites rather than inserting. I suppose it's considered beyond the scope of the book to explain filesystem behavior, but it wouldn't hurt for clarification to be included.

    perlfaq5 has a FAQ question entitled "How do I change, delete, or insert a line in a file, or append to the beginning of a file?" I think that after reading that you will probably have fewer questions, and a more thorough understanding of how to insert without overwriting.


    Dave