in reply to undef/re-set an array of hash references ?

I created what I think is an array of hash references like this: push @{$infilestore{$id}}, (split //, $seq);

What you've got is a hash of array references. Each key ($id) in %infilestore points to a value which is a reference to an array. Thus, in your code above you are dereferencing the array and appending the values you get from splitting $seq

To clear the hash, you can say undef(%infilestore) or %infilestore = (), or foreach over the keys using delete to clear that entry (not recommended if you just want to get rid of everything though <update>for reasons of efficiency</update>).

Replies are listed 'Best First'.
Re: Re: unde/re-set an array of hash references ?
by Anonymous Monk on Dec 10, 2002 at 11:00 UTC
    Thanks for the help guys. The hash of array references definition
    makes sense.

    I was trying a foreach approach to clear %infilestore, but when
    I closed an old file (clearing the hash, I hoped) and opened
    a new file, the two would concatenate together - ie. the
    hash would be added to but initial values wern't cleared.

    %infilestore=(); is doing the trick, thanks fever. Why is using foreach
    not recommended if you want to delete everything,
    I would've thought it would do the job fine but apparently not.
    Thanks again,
    basm101