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

Re: Interesting problem on perl data structure

by jettero (Monsignor)
on Oct 12, 2009 at 14:02 UTC ( [id://800717]=note: print w/replies, xml ) Need Help??


in reply to Interesting problem on perl data structure

I usually tackle this with Data::Dumper. I suspect there's a better way if you need it efficient. But in module tests, where I actually do this, it's ok.
use Data::Dumper; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Indent = 0; if( Dumper($struct1) eq Dumper($struct2) ) { warn "same!" } else { warn "not same. :(" }
Oh, wait, this won't help at all. I missed the word similar. Nevermind.

-Paul

Replies are listed 'Best First'.
Re^2: Interesting problem on perl data structure
by ctilmes (Vicar) on Oct 12, 2009 at 16:53 UTC
    BTW, Test::More's is_deeply() can be used to test data structure equivalence (though not, as you point out, the OP's 'similar').

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://800717]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-28 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found