Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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

by Marshall (Abbot)
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991733]
[marto]: Eily, there's actually a lot of good discussion on the topic in the HN link choroba posted
[marto]: sorry for the late response, busy busy :/
[Corion]: I think you need to load Readline in the debugger, but I don't know how
[Corion]: Yay, invitation for a team-building workshop, with a team of 100 people :-/

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-07-26 15:01 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (396 votes). Check out past polls.