"He asked me to do it by iterating through both the structures and then comparing them."

I would recommend that you start by writing code that just prints these 2 structures.That is the iterating part.

There are modules like Data::Dumper than can do this for you. But, you should know how to access each individual element for yourself. Once you've done that (can access and print all the pieces), then you can come up with a strategy to compare these various pieces together.

There are many people here who can easily solve this problem, but we really aren't helping you learn Perl if we give you a "cut-and-paste" thing. Have a "go at it" yourself and post your code. You will get hints if you are "stuck".


In reply to Re: Compare array of hashes by Marshall
in thread Compare array of hashes by AnishaM

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.