Just use the first four fields, plus delimiters, as your hash key. Put the contents of one file in an array and associate line numbers with hash key:
for (@file1) { $h{join ' ',(split / /)[0..3]} = $c++; }
Then run through the other file, matching key and printing if rest isn't equal:
while (<DATA>) { $key = join ' ',(split / /)[0..3]; if (exists $h{$key}) { print if $_ ne $file1[$h{$key}]; } }
You'll want to change the delimiter to something other than spaces, but the following is a working section of code for demonstration purposes:
use strict; use warnings; my ($c, %h, $key); my @file1 = ( "A B C D E F G\n", "A C B D E F G\n", "D B C A E F G\n", "B B C D E F G\n" ); for (@file1) { $h{join ' ',(split / /)[0..3]} = $c++; } while (<DATA>) { $key = join ' ',(split / /)[0..3]; if (exists $h{$key}) { print if $_ ne $file1[$h{$key}]; } } __DATA__ A B C D E F G A C B D E F H D B C A I F G B B C D E F G

In reply to Re: 2 Hash Tables, 4 Keys...what to do? by TedPride
in thread 2 Hash Tables, 4 Keys...what to do? by Anonymous Monk

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.