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').