or download this
foreach my $pair_ref ( @{ $r{$k} } ) { # for each [col4,col6] pai
+r that matched on the four-column key
my ($col4, $col6) = @$pair_ref; # get the (col4,col6) valu
+es
$x += $col4; # x is the summation of al
+l the matching col4 values
$y += $col6; # similar for y
}