Thread sortieren (2 answers)
Opened by Andreas at 2008-04-25 16:28

Linuxer
 2008-04-25 16:48
#108873 #108873
User since
2006-01-27
3882 Artikel
HausmeisterIn

user image
Ähnliche Lösung, ebenfalls Schwartzsche Transformation:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl -w
use strict;

my @list = qw( C1 C12 R5 C3 C21 C2 C12 );

my @sort =
    map { $_->[0] }
    sort { $a->[1] cmp $b->[1] || $a->[2] <=> $b->[2] }
    map { [ $_, m/^(\D+)(\d+)/ ] }
    @list;


print "@sort\n";
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread sortieren