Thread Array-Sortierung nach vorgegebenen Mustern?
(2 answers)
Opened by toby at 2008-09-12 17:48 Code (perl): (dl
)
1 2 3 4 5 6 7 my @sorted = map { $_->[1] } sort { $a->[0] <=> $b->[0] || $a->[1] cmp $b->[1] } map { [tr/-// ? 0 : tr/_// ? 1 : 2, $_] } @array; nennt sich http://en.wikipedia.org/wiki/Schwartzian_transform 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: ![]() ![]() |