Thread Sortieren komplexer Datenstrukturen: wieder mal nicht mehrdimensional (6 answers)
Opened by root at 2004-08-18 22:12

renee
 2004-08-18 22:31
#49377 #49377
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Kannst Du doch so machen:
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
    my %spaltennamen = ();
my @filialen;
my $cnt = 0;

my $statement="SELECT * FROM filialen";
my $sth = $dbh->prepare($statement) or die("Kann keine Abfrage ($statement) starten:$DBI::errstr");
$sth->execute;
#print "$statement ==> $DBI::errstr<br>\n";
my $row;
while ($row = $sth->fetchrow_hashref)
{
my %temp=%$row;
$temp{'entfernung'} = &entfernung($temp{'bgrad'},$temp{'lgrad'}, $standort{'bgrad'},$standort{'lgrad'});
if ($temp{'entfernung'} <= $eingang{'umkreis'}){
foreach my $key (keys %temp){
push(@filialen,\%temp);
$spaltennamen{$key}++;
}
}
$ausgabe{'error'} = 0;
$cnt++;
last if $cnt > 1000;
}
$sth->finish;

@filialen = sort{$a->{entfernung} <=> $b->{entfernung}}@filialen;
my %ergebnis;
foreach my $key(keys(%{$filialen[0]})){
$ergebnis{$key} = join('|',map{$_->{$key}}@filialen);
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Sortieren komplexer Datenstrukturen: wieder mal nicht mehrdimensional