What have you tried? There is a neat trick you can use in Perl to make it easy to mock up a few files that may help you get started on a solution. Consider:

use strict; use warnings; my $file1Str = <<FILEDATA; Alex 3 44 Barry 2 44 James 6 45 Drew 9 43 Alex 124 175 FILEDATA my $file2Str = <<FILEDATA; James 1 22 Alex 89 120 Alex 134 155 Barry 12 24 FILEDATA my $file3Str = <<FILEDATA; Alex 154 174 James 29 45 Drew 19 54 Drew 139 154 FILEDATA open my $fileIn, '<', \$file1Str; print "Prim: $_" for <$fileIn>; close $fileIn; for my $secFile ($file2Str, $file3Str) { open my $secIn, '<', \$secFile; print "Sec: $_" for <$secIn>; }

Prints:

Prim: Alex 3 44 Prim: Barry 2 44 Prim: James 6 45 Prim: Drew 9 43 Prim: Alex 124 175 Sec: James 1 22 Sec: Alex 89 120 Sec: Alex 134 155 Sec: Barry 12 24 Sec: Alex 154 174 Sec: James 29 45 Sec: Drew 19 54 Sec: Drew 139 154

The trick is using a string as an input file by passing a reference to it in place of a file name in the open statement. That allows you to easily include several tests "files" in your source code so you can easily play around with test data. It also makes it really easy for us to reproduce your results when you ask a question concerning your code.

True laziness is hard work

In reply to Re: multi column multi file comparison by GrandFather
in thread multi column multi file comparison by onlyIDleft

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.