Thread Sortieren: nach einem Array von einem Array (16 answers)
Opened by Gast at 2003-11-03 13:05

renee
 2003-11-03 13:42
#68968 #68968
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
z.B.:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
#! /usr/bin/perl -w

use strict;
use diagnostics;
use warnings;
use Data::Dumper;

my @array = (['test','renee',1],['dies ist','jan',3],['ein','n00b',2]);
my @array2 = sort({$$a[2] <=> $$b[2]} @array);

print Dumper(\@array);
print Dumper(\@array2);

Ausgabe:$VAR1 = [
[
'test',
'renee',
1
],
[
'Dies ist',
'jan',
3
],
[
'ein',
'n00b',
2
]
];
$VAR1 = [
[
'test',
'renee',
1
],
[
'ein',
'n00b',
2
],
[
'Dies ist',
'jan',
3
]
];
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Sortieren: nach einem Array von einem Array