Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 218909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:47:44+00:00 2026-05-11T18:47:44+00:00

The requirements are : Fact 1 : We have some data files produced by

  • 0

The requirements are :

Fact 1 : We have some data files produced by a legacy system

Fact 2 : We have some data files produced by a new system that should eventually replace the legacy one

Fact 3 :

  1. Both the files are text/ASCII files,
    with records being composed of
    multiple lines.
  2. Each line, within a record, consists
    of a fieldname and fieldvalue.
  3. The format in which the lines are
    presented are different between 1
    and 2, but fieldname and fieldvalue
    can be extracted from each line
    through use of regex
  4. Field names can change between 1 and
    2, but we have a mapping that
    relates them
  5. Each record has a unique identifier
    that helps us relate the legacy
    record with a new record as ordering
    of records in the output file need
    not be same across both systems.
  6. Each file to compare is a minimum of
    10 MB to an average case of 30 – 35
    MB

Fact 4 : As and when we iterate though building the new system, we would need to compare the files produced by both systems under exact same conditions and reconcile the differences.

Fact 5 : This comparison is being done manually using an expensive visual diff tool. To help in this, I wrote a tool that brings the two different fieldnames into a common name and then sorts the field names in each record, in each file, so that they sync in order (new files can have extra fields that is ignored in the visual diff)

Fact 6 : Due to the comparison being done manually by humans, and human making mistakes, we are getting false posetives AND negatives that is significantly impacting our timelines.

Obviously the question is, what should ‘ALG’ and ‘DS’ be?

The scenario I have to address :

I want to build a PERL program that will

  1. read relevant info from both files
    into an datastructure ‘DS’
  2. process and find the differences
    using algorithm ‘ALG’, between
    records from the DS
  3. Display/report the statistics to the
    end user, like how many lines
    (values) differed between the
    records, where they differ or are
    the values completely different, are
    lines missing (files from new system
    can have extra fields, but they MUST
    contain all lines that are there in
    the files produced by the legacy
    system)

My suggestions for:

DS : Multiple nested hash tied to disk.

Looks like:

$namedHash { unique field value across both records } = {

    legacy_system => {

        'goodField' => 'I am good!',
        'firstField' => 1,
        'secondField' => 3
    },

    new_system => {

        'firstField' => 11,
        'secondField' => 33,
        'goodField' => 'I am good!'
    }
};

ALG : Custom key – by key comparison between anonymous hashes pointed to by legacy_system and new_system keys. Any differences will be noted down by inserting a new key ‘differences’ that will be an array of field names that differ between legacy and new system.

Hence, for this example, the output of my ALG will be:

$namedHash { unique field value across both records } = {

    legacy_system => {

        'goodField' => 'I am good!',
        'firstField' => 1,
        'secondField' => 3
    },

    new_system => {

        'firstField' => 11,
        'secondField' => 33,
        'goodField' => 'I am good!'
    },

    differences => [firstField, secondField];
};

What would you have done/suggest in this given scenario?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:47:44+00:00Added an answer on May 11, 2026 at 6:47 pm

    Why not import all the data to a SQLite database. You need only one table with a single primary key corresponding to the unique identifier common to both systems. Columns should be the union of legacy and new fields.

    Import one data set first, say the set generated by the new system. Then, for every item in the legacy set, try UPDATE on the corresponding entry in the table: If UPDATE fails, you know that the new data set is missing those entries that used to exist in the old system.

    If any of the columns corresponding to the legacy data have NULLs, then you know the entries in the new system that did not exist in the legacy system.

    You can then SELECT rows where any column from the new system does not match the corresponding column from the old system.

    IMHO, this more flexible than a hash table based system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 298k
  • Answers 298k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer -(void) addHeroType:(int)newMobType atX:(int)x atY:(int)y fromMobTable:(Mobdefs*) newMobTable That is declared as… May 13, 2026 at 7:31 pm
  • Editorial Team
    Editorial Team added an answer I've seen projects deal with this by deploying SQL Server… May 13, 2026 at 7:31 pm
  • Editorial Team
    Editorial Team added an answer Not sure if this is what you're looking for, but… May 13, 2026 at 7:31 pm

Related Questions

Here's my situation... I'm writing a .Net/C# security system (authorization and authentication) for a
I'd just like someone to verify whether the following problem is NP-complete or if
I ask this academically, I want to ask aloud a very important question and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.