in reply to incorrect results

You could always dump the structures to have verified that they contain what you expected. See Data::Dumper therefore.

Or use Super Search (keyword: 'Data::Dumper') which will turn up many examples that are used in actual code.