So my question is, have a missed something?

hmm... the output of your last script

$VAR1 = [ 'Only in test1/: different1', 'Only in test2/: different2', 'Only in test2//common: common.txt~', 'Files test1//common/common.txt and test2//common/common.txt + differ' ]; --- test1//common/common.txt Wed Mar 8 11:41:08 2017 +++ test2//common/common.txt Wed Mar 8 11:44:35 2017 @@ -1 +1 @@ -This is a common line +This is a common line.

is very similar to the output diff -ru produces:

qwurx [shmem] ~/tmp/diff> diff -ur test1 test2 diff -ur test1/common/common.txt test2/common/common.txt --- test1/common/common.txt 2017-03-09 12:28:15.215474776 +0100 +++ test2/common/common.txt 2017-03-09 12:28:38.639837796 +0100 @@ -1 +1 @@ -This is a common line +This is a common line. Only in test2/common: common.txt~ Only in test1: different1 Only in test2: different2

and it is trivial to filter that output to resemble that of your script.
Perhaps you want to tell us what kind of output you are aiming for, and the purpose of it all?

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Recursive Directory Comparison and Export Differences by shmem
in thread Recursive Directory Comparison and Export Differences by thanos1983

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.