Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 avoiding work at the Monastery: (5)
As of 2019-12-06 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (154 votes). Check out past polls.

    Notices?