Skip to content

Instantly share code, notes, and snippets.

@coela
Created December 8, 2012 10:11
Show Gist options
  • Select an option

  • Save coela/4239688 to your computer and use it in GitHub Desktop.

Select an option

Save coela/4239688 to your computer and use it in GitHub Desktop.
use 5.14.2;
use warnings;
use Data::Dump;
my %value;
open my $C, '<', $ARGV[0] || die;
while (<$C>) {
chomp;
my @line = split /\t/;
$value{$line[0]} = $line[1];
}
close $C;
open my $D, '<', $ARGV[1] || die;
while (<$D>) {
chomp;
my @line = split /\t/;
$value{$line[0]} += $line[1];
}
close $D;
for (sort {$a <=> $b} keys %value) {
say join "\t", ($_, $value{$_}/2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment