# In the read loop $seen{$key1}[Key] //= $key; $seen{$key1}[Sum] += $value; $seen{$key1}[Count]++; # Total count for the number of times this value exists $seen{$key1}[Files]{$ARGV}++; # Count in this file