Thread Alle Varianten von x Arrays ermitteln (13 answers)
Opened by marky at 2007-11-24 17:06

renee
 2007-11-24 17:29
#102960 #102960
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use strict;
use warnings;
use Set::CrossProduct;

my @a1 = qw/grĂ¼n rot schwarz/;
my @a2 = qw/s m l xl/;
my @a3 = qw/ 100 120 140 160 170 180/;

my @sets = (\@a1, \@a2, \@a3 );

my $set = Set::CrossProduct->new( \@sets );
my $tuples = $set->combinations;

for my $tuple ( @$tuples ){
    print "@$tuple\n";
}
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 Alle Varianten von x Arrays ermitteln