#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; my ($href1, $href2) = get_data(); is_deeply( $href2, $href1, 'Hashref comparison' ); ## Sub to fetch data below; add code to read files if needed sub get_data { my $href1 = { system => { security => { management_ip => { protocol => { internal => {}, shutdown => {}, allow => {}, entry_1 => { snmp_ok => 'foo', }, exit => {}, }, }, }, }, }; my $href2 = { system => { security => { management_ip => { protocol => { internal => {}, shutdown => {}, allow => {}, entry_1 => { snmp_ok => 'bar', }, exit => {}, }, }, }, }, }; return $href1, $href2; } __END__ #### $ perl 1140982.pl 1..1 not ok 1 - Hashref comparison # Failed test 'Hashref comparison' # at 1140982.pl line 8. # Structures begin differing at: # $got->{system}{security}{management_ip}{protocol}{entry_1}{snmp_ok} = 'bar' # $expected->{system}{security}{management_ip}{protocol}{entry_1}{snmp_ok} = 'foo' # Looks like you failed 1 test of 1. $