Leser: 5
10 Einträge, 1 Seite |
1
2
3
4
5
6
for (keys %navi) {
$navigation .= strong ($_);
for (keys %{$_}) {
$navigation .= br (). br (). a ({-href => Adresse}, "Name);
}
}
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
30
31
32
#!c:/perl/bin/perl.exe
use strict;
use warnings;
use Data::Dumper;
use CGI qw/:all start_ul/;
my %navi = ( "Java" => {
"Switch" => ["Switch","switch.htm"],
"Bubble" => ["Bubblesort","Bubble.htm"]
},
"Andere" => {
"Switch" => ["Switch","switch.htm"],
"Bubble" => ["Bubblesort","Bubble.htm"]
}
);
my $navigation = '';
for my $key (sort keys %navi) {
$navigation .= h4($key) . start_ul . "\n";
for (sort keys %{$navi{$key}}) {
$navigation .= a({-href=>$navi{$key}{$_}[1],-alt=>$navi{$key}{$_}[0]},$_) . "\n";
}
$navigation .= end_ul . "\n";
}
print $navigation;
_ _ END _ _
<h4>Andere</h4><ul>
<a href="Bubble.htm" alt="Bubblesort">Bubble</a>
<a href="switch.htm" alt="Switch">Switch</a>
</ul>
<h4>Java</h4><ul>
<a href="Bubble.htm" alt="Bubblesort">Bubble</a>
<a href="switch.htm" alt="Switch">Switch</a>
</ul>
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";
}
}
}
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'
10 Einträge, 1 Seite |