Is there maybe a faster way to do this task?

Probably, but that depends on precisely the problem at hand. eg. every field in the example given is the same length - coincidence, or is that really a feature of the dataset? Such details can be very important.

Another question is: does it matter if there's a faster way? Everybody likes their code to run faster but if a solution you come up with completes in a short enough time is there any reason to look for something faster, other than purely for the knowledge? It's an admirable trait but you can fall into the trap of over-analysing things when almost any approach might be fast enough.

As you are new to Perl, I would advise you to try the approach which you have suggested (which sounds fine, by the way), see if you can code it up and then see how fast it runs. If you have 2 files with maybe 100k records in each it should run plenty fast enough (a few seconds at the very most on modern hardware) - if it takes longer than that then by all means come back, show your code and ask for more specific help.

Good luck with your task.


🦛


In reply to Re: Find common substrings by hippo
in thread Find common substrings 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.