Thread Key für verschachtelte Hash
(4 answers)
Opened by Hagen at 2008-02-06 13:06 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 use strict; use warnings; my %daten; $daten{feld1}{Wert1} = "Inhalt 1 1"; $daten{feld1}{Wert2} = "Inhalt 1 2"; $daten{feld1}{Wert3} = "Inhalt 1 3"; $daten{feld2}{Wert1} = "Inhalt 2 1"; $daten{feld2}{Wert2} = "Inhalt 2 2"; $daten{feld2}{Wert3} = "Inhalt 2 3"; $daten{feld3}{Wert1} = "Inhalt 3 1"; $daten{feld3}{Wert2} = "Inhalt 3 2"; $daten{feld3}{Wert3} = "Inhalt 3 3"; for my $Name1 (keys(%daten)){ my $Wert1=$daten{$Name1}; print "-> $Name1\n"; if(ref($Wert1) eq 'HASH'){ for my $Name2 (keys(%{$Wert1})) { my $Wert2 = $Wert1->{$Name2}; print "--> $Name2, $Wert2\n"; } } } |