use strict; use warnings; use Test::More; use Data::Dump qw/pp/; sub ignore_fields { my $h_in = shift; my $h_out; my @to_ignore =qw(time); while ( my ($pk, $h_matches) = each %$h_in ) { my $h_filtered = { %$h_matches }; delete @$h_filtered{@to_ignore}; $h_out->{$pk}=$h_filtered; } return $h_out; } pp ignore_fields($h_data1); pp $h_data1; is_deeply(ignore_fields($h_data1), ignore_fields($h_data2), "is_deeply");