while (<$in1>){ chomp; my ($key,$value) = split (/\s*=\s/); if (exists $hash{$key}){ print $out "$key => $hash{$key}, $value \n"; }else{ print $out1 "$key => $value \n"; } }