in reply to Re^2: Common elements of a hash of hashes
in thread Common elements of a hash of hashes

The first call of the first function will remove the uncommon elements. For every subsequent call to that function and to the other functions, %HoH will only contains keys common to all hashes. You need to deeply copy %HoH before passing it to the functions.

Alright, I felt this would be an issue, but thought I had resolved it by passing a reference to each sub and then dereferencing it. Unfortunately, I missed the fact that the values of the hash were references, which would modify the original values in place... I plead guilty.

To deeply copy the structure, I've just read about the dclone function from Storable.pm, I believe this is what's needed.

I'll rewrite the small script in hope it can be more meaningful and useful than what I previously posted.

  • Comment on Re^3: Common elements of a hash of hashes