use Data::Dumper; if (Dumper(\%struct1) eq Dumper(\%struct2)) { do something; }