in reply to Re: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
in thread Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
use strict; use warnings; use constant { FILE_A => './kma', FILE_B => './kma2', }; my %a_hash; my @a_array; my @b_array; open my $a_fh, "<", FILE_A; while (<$a_fh>) { chomp; my ($key, $value) = split '=', $_, 2; $a_hash{$key} = $value; } open my $b_fh, "<", FILE_B; while (<$b_fh>) { chomp; my ($key, $value) = split '=', $_, 2; $a_hash{$key} = $value; } open my $c_fh, ">", FILE_A or die $!; print $c_fh "$_=$a_hash{$_}\n" for (keys %a_hash);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
by LanX (Saint) on Oct 11, 2013 at 21:36 UTC | |
|
Re^3: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
by marinersk (Priest) on Oct 11, 2013 at 21:15 UTC | |
by Shariq (Initiate) on Oct 14, 2013 at 02:52 UTC | |
|
Re^3: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
by pvaldes (Chaplain) on Oct 14, 2013 at 20:38 UTC |