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

format_c
 2003-11-23 17:49
#72568 #72568
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Hier mal ein Ansatz:
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
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>


Was du mit dem alt-Attribut in einem normalen Link machen willst ist mir zwar schleierhaft, aber bitte.

Gruß Alex\n\n

<!--EDIT|format_c|1069602730-->

View full thread Hash dereferenzieren