#!/usr/bin/perl -w
#
# hash of arrays, Perl-Kochbuch S. 392
#
# 010930
#

my ($i, %hash, $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 !!!
}

