#!/usr/bin/perl -w
#
# hash of hashes, s.a. Objekte S. 29ff
#
# 051115
#

my ($i, %hash, $rhash, %hash2, $rhash2, $string, 
    $name, $vname, $ort, $land, $key );

%hash = (LAND => "BRD", ORT => "SBR") ;  # literale Werte im Hash
 # %hash = ("LAND", "BRD", "ORT", "SBR") ;  # wie oben
push( @{ $hash{ "NAME" } }, "SonnyBoy" );
push( @{ $hash{ "NAME" } }, "Williams" );

while ( ( $key, $string ) = each %hash ) {
   $isref = ref( $string );
   print "key: $key, value: $string, ref: $isref\n";
}

foreach  $string ( keys %hash ) {
 #   gibt die nicht array-werte aus, array wird als ARRAY angezeigt:
 #   print "$hash{ $string }\n";
   $isref = ref( $hash{$string} );
   if (! $isref) {$isref = "no reference!"} ;
   print "key: $string, value: $hash{$string}, hash{key}: @{ $hash{$string} }",
         ", ref: $isref\n";
 #   print "string:  @$hash{$string}  \n"; # FALSCH !!!
}

__END__

key: NAME, value: ARRAY(0x177f13c), ref: ARRAY
key: LAND, value: BRD, ref: 
key: ORT, value: SBR, ref: 
key: NAME, value: ARRAY(0x177f13c), hash{key}: SonnyBoy Williams, ref: ARRAY
key: LAND, value: BRD, hash{key}: , ref: no reference!
key: ORT, value: SBR, hash{key}: , ref: no reference!
