I'm trying to store a named array in a hash(%dbm), which ought to be entirely possible. with the key,value pairs being the name and array respectively.

I'm using the following line to add items to the array:-

        push @{ $dbm{ $name } }, "$ID";

So the key in $name has ID added as an extra member of its array. This is done repeatedly with many new items added to the arrays for different names. But, the first one is somehow always missed. Whatever this script adds to the arrays, the first one somehow misses and is simply not in the array, although all other members are there as expected.

I know there can be referencing problems in complex data structures, but I am sure the code is correct, in particular because whatever tests I do with test scripts that add multiple array items for many names (keys), they always work perfectly. I'm using the exact same code and setting up variables in the same way, but it works in one and not the other.

This is the real puzzle. I am never surprised when code doesn't do what I expect, but in this case it works perfectly in the test scripts, exactly as expected and required, but in the real script in which it actually needs to work, the first attempt to add an item always fails and I am at a loss to understand what the reason could be.

Can anyone shed any light on why this 'push'ing onto the array might fail for the first item only? If I have some ideas about that I can investigate further as to how this might occur in one script but not the other.

Please???



Ken  G i l l e t t

_/_/_/_/_/_/_/_/_/


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to