Thread Sort()
(10 answers)
Opened by taikahn22a at 2008-05-08 22:02 Code (perl): (dl
)
1 2 3 4 5 6 use warnings; use strict; my @array = (1..20); my @array3 = sort { $a <=> $b } map { $_ % 5 } @array; print join(', ', @array3); Ausgabe: 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4 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"
|