For a quick check this might do?

perl -MData::Dump=pp -nle"push @{ $h{ $_ } }, $ARGV }{ pp\%h" 30.txt 4 +0.txt { X0001 => ["30.txt", "40.txt"], X0002 => ["30.txt", "40.txt"], X0003 => ["30.txt", "40.txt"], X0004 => ["30.txt", "40.txt"], X0006 => ["30.txt", "40.txt"], X0007 => ["40.txt"], X0008 => ["30.txt", "40.txt"], X0009 => ["30.txt"], X0010 => ["30.txt", "40.txt"], X0011 => ["30.txt", "40.txt"], X0012 => ["30.txt", "40.txt"], X0013 => ["30.txt", "40.txt"], X0014 => ["30.txt"], X0015 => ["30.txt", "40.txt"], X0016 => ["30.txt", "40.txt"], X0017 => ["40.txt"], X0018 => ["30.txt", "40.txt"], X0019 => ["30.txt", "40.txt"], X0020 => ["30.txt"], X0021 => ["40.txt"], X0022 => ["40.txt"], X0023 => ["30.txt", "40.txt"], X0024 => ["40.txt"], X0025 => ["30.txt", "40.txt"], X0026 => ["30.txt", "40.txt"], X0027 => ["30.txt", "40.txt"], X0028 => ["40.txt"], X0029 => ["30.txt", "40.txt"], X0030 => ["30.txt"], X0031 => ["40.txt"], X0032 => ["30.txt", "40.txt"], X0033 => ["40.txt"], X0034 => ["30.txt", "40.txt"], X0035 => ["30.txt"], X0038 => ["40.txt"], X0039 => ["30.txt"], X0040 => ["40.txt"], X0041 => ["40.txt"], X0043 => ["40.txt"], X0044 => ["40.txt"], X0045 => ["30.txt", "40.txt"], X0046 => ["40.txt"], X0047 => ["30.txt", "40.txt"], X0048 => ["40.txt"], X0049 => ["40.txt"], X0050 => ["30.txt", "40.txt"], }

Perhaps an improvement:

perl -nlE"push@{$h{$_}},$ARGV}{say qq[@{$h{$_}}:$_] for keys%h" 30.txt + 40.txt | sort 30.txt 40.txt:X0001 30.txt 40.txt:X0002 30.txt 40.txt:X0003 30.txt 40.txt:X0004 30.txt 40.txt:X0006 30.txt 40.txt:X0008 30.txt 40.txt:X0010 30.txt 40.txt:X0011 30.txt 40.txt:X0012 30.txt 40.txt:X0013 30.txt 40.txt:X0015 30.txt 40.txt:X0016 30.txt 40.txt:X0018 30.txt 40.txt:X0019 30.txt 40.txt:X0023 30.txt 40.txt:X0025 30.txt 40.txt:X0026 30.txt 40.txt:X0027 30.txt 40.txt:X0029 30.txt 40.txt:X0032 30.txt 40.txt:X0034 30.txt 40.txt:X0045 30.txt 40.txt:X0047 30.txt 40.txt:X0050 30.txt:X0009 30.txt:X0014 30.txt:X0020 30.txt:X0030 30.txt:X0035 30.txt:X0039 40.txt:X0007 40.txt:X0017 40.txt:X0021 40.txt:X0022 40.txt:X0024 40.txt:X0028 40.txt:X0031 40.txt:X0033 40.txt:X0038 40.txt:X0040 40.txt:X0041 40.txt:X0043 40.txt:X0044 40.txt:X0046 40.txt:X0048 40.txt:X0049

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: One liner to compare to lists and print the ID's in common by BrowserUk
in thread One liner to compare to lists and print the ID's in common by ZWcarp

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.