Thread Problem mit einem Hash of Hashes (10 answers)
Opened by Dingels at 2008-12-11 19:09

pq
 2008-12-11 20:48
#117103 #117103
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
my %max;
for my $type (keys %hash) {
    my $values = $hash{$type};
    my $max = (sort {
        $values->{$b} <=> $values->{$a}
    } keys %$values )[0];
    $max{$type} = "$max $values->{$max}";
}
print Dumper \%max;
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Problem mit einem Hash of Hashes