in reply to Re: Find duplicate values in hash
in thread Find duplicate values in hash

Thank you all very much for the quick responses, all of them really helpful and instructive. So far I have tried JavaFan's and Nkuvu's solutions, and they work just fine. (I will need some time to understand exactly how they work though, might come back here if I fail to do so...). Thanks also for the pointers to Data::Dumper and the explanation as to why I was getting that error.

Replies are listed 'Best First'.
Re^3: Find duplicate values in hash
by moff (Novice) on Apr 17, 2009 at 19:17 UTC
    Hello again, I have finally used JavaFan's code, changing it slightly to get an output similar to Nkuvu's, and managed to package it with PAR to get a standalone program. I can say it works flawlessly even with very large files with many thousands of lines. Thanks again. However, I still do not understand it thoroughly. I think I understand everything except
    push @{$reverse{$value}}, $key;
    What exactly happens here for each pair of keys and values of my first hash? I can see that, after that, in those cases where the value is the same for two or more keys, those two or more keys are contained in one "key array" (?) (one line if I print it out), and subsequently split with local $". But I do not really understand the above line of code. If JavaFan or someone else could explain it with words I would very much appreciate it.