for my $key (keys %left) { if ( exists $right{$key} ) { my result = $left{$key} - $right{$key}; print "$key | $result\n"; } }