You might also try doing the unless defined for $d2 instead of/as well as $d1. Otherwise, you'll have to wait until I have time to look at this properly - it's not something that Test::Deep supports out of the box but it is something that I would like it to support.