Thread Hash dereferenzieren (9 answers)
Opened by SirLant at 2003-11-23 17:02

Crian
 2003-11-23 17:55
#72569 #72569
User since
2003-08-04
5873 Artikel
ModeratorIn
[Homepage]
user image
Hier:

Code: (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
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Data::Dumper;

my %navi = (
"Java" => {
"Switch" => ["Switch","switch.htm"],
"Bubble" => ["Bubblesort","Bubble.htm"],
},
"Dings" => {
"Urgs" => ["Urgelurgs","uuuuuurgllll.htm"],
"Gnubbel" => ["Gubblesort","Gnubbel.htm"],
},
);

for my $key (sort keys %navi) {
print "Key '$key'\n";
for my $innerkey (sort keys %{$navi{$key}}) {
print "\tInner Key: '$innerkey'\n";
for my $value (@{$navi{$key}{$innerkey}}) {
print "\t\t\tWert = '$value'\n";
}
}
}


Ausgabe:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Key 'Dings'
Inner Key: 'Gnubbel'
Wert = 'Gubblesort'
Wert = 'Gnubbel.htm'
Inner Key: 'Urgs'
Wert = 'Urgelurgs'
Wert = 'uuuuuurgllll.htm'
Key 'Java'
Inner Key: 'Bubble'
Wert = 'Bubblesort'
Wert = 'Bubble.htm'
Inner Key: 'Switch'
Wert = 'Switch'
Wert = 'switch.htm'
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite

View full thread Hash dereferenzieren