Q:

Perl: Dereference array of Multidimensional hashes

My overall structure has three layers:
The first layer is a hash: Key:Continent  Value: Country
The second layer is a hash: Key: Country  Value: 2D array with specific countries
The Third layer is a 2D array
So far I have my code below:
#! /usr/bin/perl
use strict;
use warnings;
use Data::Dumper qw(Dumper);

my %hash=(); #initialize a hash 
my $hash_ref = \%hash;

$hash{continent} = { 
    America => [
    ['North', 'Canada', 'USA'],
    ['South', 'Peru', 'Brazil'],
    ],
    Asia => [
    ['East', 'Japan', 'China'],
    ['Sounth', 'India','Bangladesh'],
    ],
}; 

foreach my $continent (keys %hash) {
    foreach my $country (keys %{ $hash{$continent} }) {
        print "$continent, $country : @{$hash{$continent}{$country}}\n";
    }
}

#print Dumper \%hash;

This is the output: 
continent, Asia : ARRAY(0x7fb159824890) ARRAY(0x7fb15a004628)
continent, America : ARRAY(0x7fb159803ee8) ARRAY(0x7fb1598240e0)
My question is:
How can I deference the 2D-array in the hash of the hash rather than get their reference?? 

A:

If you have a choice, you should change your data structure's design to what @bipll suggested.  Your existing data structure's design requires more complex code than necessary.  If you can't, read on. 

The first loop is incorrect. 
This doesn't iterate over the continent names:
foreach my $continent (keys %hash) {

This does:
foreach my $continent (keys %{ $hash{continent} }) {

The second loop is incorrect. 
$hash{$continent} now $hash{continent}{$continent} is a reference to an array, not a reference to a hash. 

Fixed:
my $by_continent = $hash{continent};
for my $continent_name (keys(%$by_continent)) {
    my $continent = $by_continent->{$continent_name};
    for my $region (@$continent) {
        my $region_name = $region->[0];
        my @country_names = @{$region}[0..$#$region];
        print("$continent_name, $region_name: ", join(', ', @country_names), "\n");
    }
}

