Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: write and read the same file not display the output

by Marshall (Prior)
on Sep 05, 2012 at 04:21 UTC ( #991733=note: print w/ replies, xml ) Need Help??


in reply to write and read the same file not display the output

What you are attempting is an extremely bad idea.

A much better general procedure is:
- open the input file
- make a new output file
- when you are finished, rename the orignal file to .bak or whatever and then rename the new file to the original name.

File system operations are complex and there is possibility when your program "bombs" or other errors happen and you will be left in an "unrecoverable situation" - the original data has been screwed up and there is maybe even no way, even with advanced techniques to recover the data.

Basically trying to modify an existing file is a very advanced and rarely used technique. I have software that does that but the problems and pitfalls are many - don't do it!


Comment on Re: write and read the same file not display the output

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991733]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-07-25 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls