Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Answer: How do I test the deep equality of two hash tables?

by cmeyer (Pilgrim)
on May 22, 2005 at 03:24 UTC ( #459306=categorized answer: print w/replies, xml ) Need Help??

Q&A > hashes > How do I test the deep equality of two hash tables? - Answer contributed by cmeyer

Another way to compare to arbitrarily complex data structures is to use canonical serialization. Storable is one module that provides this capability.

For example:

use Storable; sub deeply_equal { my ( $a_ref, $b_ref ) = @_; local $Storable::canonical = 1; return Storable::freeze( $a_ref ) eq Storable::freeze( $b_ref ); }

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2020-10-01 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (19 votes). Check out past polls.

    Notices?