Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: writing blank array to file?

by dimmesdale (Friar)
on Jun 18, 2001 at 20:08 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found