is_deeply()

For comparing complex data structures

my %expect = ( this => 42, that => [qw(1 2 3)] );
my %got = some_function();
is_deeply( \%got, \%expect );

Will show you where the two structures start to diverge

not ok 1
#     Failed test (- at line 2)
#     Structures begin differing at:
#          $got->{that}[2] = '3'
#     $expected->{that}[2] = Does not exist

(In CS this is really a "shallow comparison" and is() is "deep")

| toc |