Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by cmeyer (Pilgrim)
on May 22, 2005 at 03:24 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found