Thread Sort() (10 answers)
Opened by taikahn22a at 2008-05-08 22:02

FIFO
 2008-05-08 22:34
#109466 #109466
User since
2005-06-01
469 Artikel
BenutzerIn

user image
Du hattest gesagt, Du wolltest eine Zahlenreihe nach ihrem Teilungsrest sortieren ... Wenn Du wirklich die Reste sortieren willst:

Code (perl): (dl )
my @array3 = sort { $a <=> $b } map { $_ % 5 } @array;


aber denk dran, dass $_ als Alias Deine @array-Elemente ändert (nur wenn Du $_ im map-Block veränderst) ...
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? -- Brian Kernighan: "The Elements of Programming Style"

View full thread Sort()