Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Help in read and write to file at a same time in same file.

by jpl (Monk)
on Apr 04, 2011 at 18:08 UTC ( [id://897378]=note: print w/replies, xml ) Need Help??


in reply to Re: Help in read and write to file at a same time in same file.
in thread Help in read and write to file at a same time in same file.

Perhaps this could be accomplished with yet another perlrun option, maybe -b (for backup). In conjunction with -i (whose behavior it would modify), we could demand that both have non-empty extensions, and further, that no two of the three names reference the same file, thereby defending against foot-shooting behavior like -i* or -b./* (for which silently deleting the "copy" might delete the original). It would then be safe to do largely as specified, after step 0, making a copy of the original in the -b extension. This keeps a backup of the original after the dust settles, much as -i does now, but also preserves the original, which won't be replaced by the -i version until it has been completely processed and closed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found