in reply to Simple Logic Problem with Perl

Maybe you could be helped in clearly stating the behavior you want by using an $expected datastructure, a $got datastructure, and Test::More. See How to Ask a Datastructures Question (with Test::More). Good luck!