Compare Perl Data structure to pattern