After much testing, I was unsuccessful, but you might want to check out Test::Deep as a framework for your comparison, with repeated commands to bag() in some hierarchical manner. The fact that it already includes tools for doing deep array comparisons could make it a strong tool in your favor.