in reply to find common data in multiple files
Instead, omit the first line. If a hash-key does not yet exist when you "increment" it, it will automatically be created with the value zero, then incremented to the value 1. (In the code as written, the value can never be anything but 1.)$result{$key} = 1; $result{$key}++;
The remainder of the solution should be straightforward: after processing all 25 files, look for keys with the value 25. (Assuming that you know that there are no duplicates in each file.) If there could be duplicates, you will need to use a second hash, cleared at the start of each file, and use the exists verb to see if a specified key is already in it (i.e. is a duplicate within this file).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: find common data in multiple files
by 1nickt (Canon) on Dec 28, 2017 at 13:46 UTC | |
by Anonymous Monk on Dec 28, 2017 at 23:56 UTC |