in reply to find common data in multiple files

Don't do this:
$result{$key} = 1; $result{$key}++;
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.)

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

    Don't do this:
    $result{$key} = 1; $result{$key}++;
    ... (In the code as written, the value can never be anything but 1.)

    Sorry, that's wrong.

    $ perl -E '$key = "wrong"; $result{$key} = 1; $result{$key}++; say val +ues %result'
    2


    The way forward always starts with a minimal test.
      "So, sue me ..." ... two!
      Nevertheless, not the increment-behavior that the programmer intended, which was the essential point. The value will always be one two.