in reply to Perl Hash Ref

Notice the different structure between PersonA and PersonB.

Yeah, you appear to have buggy code. Specifically, you forgot to specify ForceArray => [qw( Pets )]I see, you have two Person records for the same Person. That's a bit odd.

Also, having <PersonA> and <PersonB> makes no sense. Tag names shouldn't be data. You should have something like <Person name="A"> and <Person name="B">.