Help for this page

Select Code to Download


  1. or download this
    my $file_count = @ARGV;
    foreach my $key1 ( keys %seen ) {
        if ( @{ $seen{$key1} } >= $file_count) {
    ...
            print "\n\n";
        }
    }
    
  2. 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.
    };
    
  3. 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
    
  4. or download this
    use Data::Dumper;
    while (<>)
    {
      # Your code here
    }
    print Dumper(\%seen);
    
  5. or download this
    use YAML;
    while (<>)
    {
      # Your code here
    }
    print YAML::Dump(\%seen);