Michele Dondi skribis 2005-02-07 11:45 (+0100): > With some effort I managed to understand _which_ sense it should make up > to this: > > } ==> sort { .<score> } is descending, { .<word>.length }, { .<word> }; > I mean: everything of what is gather()ed gets 'piped' into sort() which > sorts according to C<< { .<score> } >>. But what are the other args to it > supposed to mean? (Sorry for being dense!)
Since I sent the message, I learned that if you want to sort with multiple criteria, the first argument should be an arrayref of closures. So what I should have written is: ==> sort [ { .<score> } is descending, { .<word>.length }, { .<word> } ]; And it's easier to write if a simple numeric minus is used: ==> sort [ { -.<score> }, { .<word>.length }, { .<word> } ]; This makes sort sort by score first, but if two words score equally, word length will become important (score with as few letters as possible, because there's a greater chance of succeeding within the time limit). If the lengths are also equal, it sorts alphabetically, so that words beginning with the same letter are grouped together. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html