Let's say you want to create a hash that has two (or more) keys, like this. In this example, name_key is below employee_key.
'employee_key' {
'name_key' => 'John Doe',
}
Create the multidimensional keys and value.
my %hash = ( 'employee_key' => { 'name_key' => 'John Doe' } );
Or like this.
my $hash{employee_key}->{name_key} = "John Doe";
Dumper can be used to print the hash.
print Dumper \%hash;
Which will produce the following.
$VAR1 = {
'employee_key' => {
'name_key' => 'Jane Doe'
}
};
Print name_key.
print $hash{employee_key}->{name_key};
Which will produce the following.
John Doe