in reply to Re^2: opening file for editing
in thread opening file for editing

you can do this in two steps:

read open dump all to a variable (in memory) apply a substitution to this variable close re-open the file, now for writing print the changed variable to the file (overwrite the whole file) and close again

No temp files here, and your file is updated as you want. Use perldoc for the details.

Replies are listed 'Best First'.
Re^4: opening file for editing
by Anonymous Monk on Oct 09, 2011 at 11:50 UTC
    oh well, this seems to be more straightforward solution, thats fine..but can this be done by opening file only once

      1. Monks have mentioned the documentation for open
      2. Monks provided hyperlinks to the documentation for open
      3. Monk specifically mentioned the +< and +> operators

      Did you read it?

        i happen to read but i couldnt figure out a solution