sub process_file { my $filename = shift or die "Missing filename!"; open (FILE, $filename) or die "Unable to open $filename because $!\n"; while ($line = ) { chomp ($line); ($chrX, $chrpos, $value11, $value22) = split (/\t/, $line); $key2 = join ("_", $chrX, $chrpos); if (exists $hash{$key2} > 0) { $hash{key2} = $value11 + $value1; $hash{key2} = $value22 + $value2; $hash{key2}++ } } close FILE; }