http://qs321.pair.com?node_id=89345


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.