in reply to Re^2: 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.

Just some suggestions

The use constant part is not needed probably, you can add the filename in the open line (saving some typing).

You have two pairs of variables with the same name for file A and File B ($key, $key, $value, $value). This is probably a source of future troubles.

You don't need to repeat the word array as variable name, if something begins with @ you know yet that is an array, something like "@first" is probable a better choice, (easier to write and read) than "@a_array". Don't use @a either.

You need to add possible spaces to the split regex, and you could probably fill the %hash directly with maybe something like: (untested)

my ($key, $a_hash{$key}) = split /\s*=\s*/, $_, 2;
  • Comment on 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.
  • Download Code