Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: writing blank array to file?

by dimmesdale (Friar)
on Jun 18, 2001 at 20:08 UTC ( #89345=note: print w/replies, xml ) Need Help??

in reply to writing blank array to file?

There are several problems with this script.
(1)Delete deletes values from an hash. . . i.e, not an array.
(2)Your file is opened to write, and yet the while(<TO_WRITE>) line is *reading* from the file. You may wish, however, to open the file for appending, and then seek your way to the top(or open it for reading, store the results in an array, close it, and open it for writing, etc.).

As to what you think your problem is, You're Wrong. You are opening the file for writing, but while doing so you are truncating it, i.e., "deleting all the elements". Type 'open' in the search box for this site and read the page for some help.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2023-06-03 23:56 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (17 votes). Check out past polls.