Kannst Du doch so machen:
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);
}