Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-01-22 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (62 votes). Check out past polls.

    Notices?