#!/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__