in reply to Re^5: I have a list expanding when I don't want it to
in thread I have a list expanding when I don't want it to
I down-voted you.
Why?
Because you are telling her, how she should program her code.
And, (BTW) assuming (arrogantly) that she hasn't/didn't already profile both possibilities and choose appropriately.
No attempt to help her. Just see the word (fast/er/est) and knee-jerk into patronizing dick mode.
Subtext
Assigning () to an array, causes the array to be emptied; but the AV* is retained; so is the hash key holding the reference to the AV*. Thus the HV* is unmodfied.
Deleting the key(s) from the hash, not only empties (GCs) the elements of the array and modifies the size of the AV*; it also modifies the hash by removing a key value pair, only to recreate it immediately.
She made the right choice. And I'm betting it wasn't by either guesswork or knee-jerk.