- or download this
my $file_count = @ARGV;
foreach my $key1 ( keys %seen ) {
if ( @{ $seen{$key1} } >= $file_count) {
...
print "\n\n";
}
}
- or download this
# At the top of the file
use constant {
Key => 0,
...
Count => 2, # Remove this if you don't use the total count
Files => 3 # Should be 2 if Count is not used.
};
- or download this
# In the read loop
$seen{$key1}[Key] //= $key;
$seen{$key1}[Sum] += $value;
$seen{$key1}[Count]++; # Total count for the number of times t
+his value exists
$seen{$key1}[Files]{$ARGV}++; # Count in this file
- or download this
use Data::Dumper;
while (<>)
{
# Your code here
}
print Dumper(\%seen);
- or download this
use YAML;
while (<>)
{
# Your code here
}
print YAML::Dump(\%seen);