in reply to local autovivification dismemberment...

I'm having a lot of trouble following, but if I understand it, @data contains one element per line of 'stuff', where that 'stuff' is parsed into multiple fields (hash keys VAL1, VAL2, etc.). Somehow, you figure out that line $count is a duplicate of $count-1, so you set its fields equal to the one before it, appending "/duplicate" to its first field. Am I right so far?

If that's the case, I can't see any reason why this would be giving you problems. Unless you've explicitely scoped this stuff locally, it shouldn't be disappearing. I think we definitely need to see some more code and context to be able to know what's going on. Some debugging code before, in, and after your 'if' block might be helpful too, and should rule out your scoping hypothesis.