So we're talking about Perl and he asks "how do I read a file, change it, and write it back out again? Do I have to close and reopen it?"
There are many different ways to do this and the best choice depends upon what you need to do, who else might be using the file, the size of the file, etc. Since many of his questions are standard questions I suggested he pick up a copy of the Perl Cookbook.
I then backpedalled (sp?) furiously. The Second Edition of the book should be out in August. I'll just loan him an extra copy and, in the meantime, drool in anticipation at the thought of the second one.
Excuse me now. I have to go wipe the saliva off my chin.