hotshot has asked for the wisdom of the Perl Monks concerning the following question:

hello again!

Is ther an easy way (or module) for comparing two arrays (for their contents and order of course) and two hashes?

Thanks.

Hotshot

Replies are listed 'Best First'.
Re: companring arrays and hashes
by broquaint (Abbot) on Apr 24, 2002 at 12:15 UTC
    Oddly enough there's the Array::Compare module (by our own davorg) for comparing arrays, or you could use the Data::Compare module for comparing any ol' data (yes, including hashes). You could also check out the perlfaq for information on how to hand-roll array and hash comparison routines. Also check out the Q&A section for even more info on how to do array and hash comparision. You're spoilt for choice really ;-)
    HTH

    _________
    broquaint

Re: companring arrays and hashes
by rinceWind (Monsignor) on Apr 24, 2002 at 12:12 UTC
    hotshot,

    Take a look at thread Need a test for deep equality. Although most of the routines did not meet my exact requirements, many of the routines here will do what you are asking.