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

  • SEARCH
  • Home
  • 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 9105315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:04:46+00:00 2026-06-17T02:04:46+00:00

I’m coding a perl script that audits a library and compares the list of

  • 0

I’m coding a perl script that audits a library and compares the list of installed software with a list from another machine to ensure that they are working off of the same stuff. I’ve taken the raw data and placed it into two, 2-dimensional arrays of size Nx4 where N is the number of software titles. For example:

[Fileset1], [1.0.2.3], [COMMITTED], [Description of file]
[Fileset2], [2.4.2.2], [COMMITTED], [Description of a different file]
....

I now need to compare the two lists to find discrepancies, whether they be missing files of level differences. Not being a perl pro yet, the only way I can conceive of doing this is to compare each element of the first array against each element of the other array to look first for matching filesets with different levels or no matching filesets at all. The I would have to repeat the process with the other list to ensure that I’d found all possible differences. Obviously with this procedure I’m looking at efficiency of greater than n^2. I was wondering if there was some application of grep that I could make use of or something similar to avoid this when comparing libraries with upwards of 20,000 entries.

In short, I need to compare two 2 dimensional arrays and keep track of the differences for each list, instead of merely finding the intersection of the two.

Thanks in advance for the help!

  • 1 1 Answer
  • 0 Views
  • 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-06-17T02:04:48+00:00Added an answer on June 17, 2026 at 2:04 am

    The output is a little unwieldy, but I like Data::Diff for tasks like this:

    use Data::Diff 'Diff';
    use Data::Dumper;
    
    @a = ( ["Fileset1", "1.0.2.3", "COMMITTED", "Description of file" ],
           ["Fileset2", "2.4.2.2", "COMMITTED", "Description of a different file" ],
           ["Fileset3", "1.2.3.4", "COMMITTED", "Description of a different file" ] );
    
    @b = ( ["Fileset1", "1.0.2.3", "COMMITTED", "Description of file" ],
           ["Fileset2", "2.4.2.99", "COMMITTED", "Description of a different file" ] );    
    
    $out = Diff(\@a,\@b);    
    print Dumper($out);
    

    Result:

    $VAR1 = {
      'diff' => [
        {
          'uniq_a' => [
            '2.4.2.2'
          ],
          'same' => [
            {
              'same' => 'COMMITTED',
              'type' => ''
            },
            {
              'same' => 'Description of a different file',
              'type' => ''
            },
            {
              'same' => 'Fileset2',
              'type' => ''
            }
          ],
          'type' => 'ARRAY',
          'uniq_b' => [
            '2.4.2.99'
          ]
        }
      ],
      'uniq_a' => [
        [
          'Fileset3',
          '1.2.3.4',
          'COMMITTED',
          'Description of a different file'
        ]
      ],
      'same' => [
        {
          'same' => [
            {
              'same' => '1.0.2.3',
              'type' => ''
            },
            {
              'same' => 'COMMITTED',
              'type' => ''
            },
            {
              'same' => 'Description of file',
              'type' => ''
            },
            {
              'same' => 'Fileset1',
              'type' => ''
            }
          ],
          'type' => 'ARRAY'
        }
      ],
      'type' => 'ARRAY'
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am confused How to use looping for Json response Array in another Array.
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have an autohotkey script which looks up a word in a bilingual dictionary

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.