perl hash

Hi i am reading one file and creating Hash from the contents of it my issue is there are 3 different files in 3 different locations having same structure so for parsing these files i have one subroutine which returns hash after reading all the 3 files i need to create consolidated hash from three how to do it ?

i managed to do it just wondering are there any better ways to do the same ?

output of data::dumper 

   direct =>{ 
                 1 => {
                           'one' => '1',
                           'two' => '2',
                           'thr'  => '3',
                         }
                } ;
  indirect =>{ 
                 1 => {
                           'one' => '1',
                           'two' => '2',
                           'thr'  => '3',
                         }
                } ;

i want to copy this in new hash at the end 

# $ret is original hash 
# $n is new hash 
foreach my $k ( keys %$ret )
{
    foreach my $m ( keys %{$ret->{$k}} )
    {
        foreach my $n ( keys %{$ret->{$k}->{$m}} )
        {
            $n->{$k}->{$m}->{$n} = $ret->{$k}->{$m}{$n}
        }
    }
}

above code is working just wondering is this the right way ?? or there are any better ways to do this . i dont want to use module for this              

Please use code tags only for CODE.

>>>

Did you mean all the data into 1 hash ?
Instead of returning hash from the sub module, pass hash reference to the sub module and manipulate the hash in the sub module itself. So, there is no need to do post processing over the hash-es returned.

soory for putting comments & code in code tag ..

its of no use now coz requirement changed ... lol