Thread Array Bearbeitungen (5 answers)
Opened by RPerl at 2008-02-15 15:49

Ronnie
 2008-02-15 17:36
#105936 #105936
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
RPerl+2008-02-15 15:08:48--
Geht das auch huebscher?

Geschmackssache:
Code (perl): (dl )
1
2
3
4
5
6
7
8
use Data::Dumper;

my @l = (2, 3, 4, 5, 2, 7, 3, 8 ,9, 1, 3 ,5 ,7, 8, 9, 1, 2, 3, 4, 5, 2, 7, 3, 
    8 ,9, 1, 3 ,5 ,7, 8, 9, 1);

my @m = map { $_ % 4 == 0 ? ($l[$_-1], int(rand(9999))) : $l[$_-1] } 1..$#l+1;

print Dumper \@m;

View full thread Array Bearbeitungen