Clean way to access an Array of Hash of Arrays : I have a segment of code that though works, does not look a clean way to do things.

So I build the structure using:
  
     foreach my $n (@node_list)
     {
        chomp ($n);

        foreach my $c (@cpes)
        {
                my @returned; #Interfaces to CPEs with MED settings
                my @creturned; #General Customer Interfaces

                my ($cust) = $c =~ /([a-zA-Z]+)[_-][a-zA-Z0-9]+/s;
                print "\n\t\tCustomer is $cust\n";

                chomp($c);
                $c = uc $c;
                my ($search) = $c;

                (@returned) = `cat /curr/$n | grep "$search"`;
                if (@returned)
                {
                        my $cust_match = 'interface \"' . $cust;
                        (@creturned) = `cat /curr/$n | egrep -i "$cust_match" | grep -v "$search"`;

                }
                if (@creturned)   #Have we found other CPEs on the same router
                {
                        my ($nf) = $n =~ /([a-zA-Z0-9-]+).cfg/s;

                        my (@interfaces) = map { /([A-Z0-9_]+)/s } @creturned;
                        @interfaces = uniq(@interfaces);

                        unshift  (@interfaces, $c);
                        push (@new_out, {$nf => {$cust => [@interfaces]}});
                }

        }


This will return:

     $VAR1 = \[
            {
              'router-xx-xx' => {
                                  '50000' => [
                                                   [
                                                     'THXXXXVF_NLXXXX40_1121_2',
                                                     '10x.xx.x.50'
                                                   ],
                                                   [
                                                     'THXXXPVF_NLXXXX66_1121_1',
                                                     '10x.xx.x.70'
                                                   ],
                                                   [
                                                     'THXXXXVF_NLXXXX67_1121_2',
                                                     '10x.xx.x.78'
                                                   ],
                                                  
                                }
            },


Each router can have a number of VPRNs and each VPRN can contain multiple interfaces. In the example above I've shown one router with one VPRN.

However, when it comes to accessing elements in the above, I've written the following convoluted (but working) code:

      foreach my $candidate (@nodes)
        {
                my %node = %{ $candidate };

                foreach my $n (keys %node)
                {
                        print "\nRouter is $n\n";

                        foreach my $cust (keys %{ $node{$n} })
                        {
                                print "Customer on $n is \n" . Dumper \$cust;
                                my @intlist = @{$node{$n}{$cust}};
   
                                my $med_cpe = $intlist[0];      #the CPE that was used to find node
                               
                                {truncated}
                                my (@mlist) = grep {$_=~ / $rid /} @info;
                                {truncated}
                                                push (@shared, [$cpe, $dip]);
                                        }
                                        push @master, {$n => {$rid => [@shared]}};;
                                }
                        }
                }
        }