in reply to how to merge this two array and update my files?

If you run this you'll be told about errors you need to fix. Add use strict; remove the duplicate #! lines. This isn't a code writing service. If you want to learn Perl read the advice and links provided in response to your previous questions, including:

If you don't want to learn perl I suggest a change of hobby/career.