Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

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


in reply to How do I test the deep equality of two hash tables?

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://459306]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2023-02-06 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (37 votes). Check out past polls.

    Notices?