Thread each-operator reseten? (12 answers)
Opened by supersucker at 2005-04-30 17:57

coax
 2005-04-30 22:40
#54342 #54342
User since
2003-08-11
457 Artikel
BenutzerIn
[default_avatar]
Wie waer's denn mit einer ,Schwartzian Transform'-Loesung ?
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl

 use strict;
 use warnings;

 my %scores = (
     134    => { Goodness => 10 },
     4273   => { Goodness => 3 },
     36285  => { Goodness => 6 },
     9284   => { Goodness => 2 },
 );

 my $best_of = 2;  # Die besten ... {zwei}

 my @sorted_scores =  map { $_->[1] }
                      sort { $b->[0] <=> $a->[0] }
                      map { [$scores{$_}->{Goodness}, $_ ] } keys %scores;

 print "$_\n" for @sorted_scores[0 .. $best_of - 1];


Mehr ueber Schwartzian Transform findest zum Beispiel auf Start's Seite.
,,Das perlt aber heute wieder...'' -- Dittsche

View full thread each-operator reseten?