Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: writing blank array to file?

by malloc (Pilgrim)
on Jun 18, 2001 at 20:10 UTC ( #89347=note: print w/replies, xml ) Need Help??

in reply to writing blank array to file?

Hmm, it seems to me like it would be simpler to use a hash. In your loop, try:
$hash{$refnum} = $scalar; $refnum++; next;
i believe that the problem that you are having now is because you are pushing a reference to an array onto an array. The expression $chunk$number (imagine square brackets there) doesn't really mean anything in the context of how you created @chunk, see?

well, i hope my ramblings helped somewhat, good luck.

Update: Wow, these guys are fast. The two above posters explained things much more clearly, and we all got so caught up in the nonsensical array references that we missed your actual problem, which wog picked out nicely below, file clobbering. However, it should be okay to clobber the file in this case, since you are going to be rewriting the whole thing from your data structure, with the deleted entries removed, right?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-01-28 08:42 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (73 votes). Check out past polls.