@Keys = sort_keys(@Keys); foreach my $key (@Keys) { open FILE, "$DIR/$key" or die "Can't open $DIR/$key: $!\n"; $Text .= "

$DATA{$key}{subject}

\n"; $Text .= "$DATA{$key}{von}\n"; $DATA{$key}{bis} and ($Text .= "  $DATA{$key}{bis}\n"); $Text .= '

'; while () { $Text .= $_; } ($DATA{$key}{link}) and ($Text .= "

... weiter lesen"); $Text .= "

\n
\n"; } $$CONFIG{actdata} = $Text; my $T = Template->new({ INCLUDE_PATH => $$CONFIG{templatedir}, POST_CHOMP => 1, }); print "Content-Type: text/html; charset=$$CONFIG{charset} "; $T->process('aktuell.html', $CONFIG) || die $T->error(); # Keys nach Datum (von) sortieren: sub sort_keys { my (%sort, $sdate, @tmp); my $i = 0; foreach my $key (@_) { $i++; @tmp = split /\./, $DATA{$key}{von}; $sdate = "$tmp[-2]$tmp[-1]$tmp[0]"; $sort{"$sdate$i"} = $key; } @sort{sort keys %sort}; }