Thread formatierte Datenausgabe (27 answers)
Opened by Norden at 2007-06-06 13:25

sid burn
 2007-06-08 13:07
#77325 #77325
User since
2006-03-29
1520 Artikel
BenutzerIn

user image
Hmm, warum Hash?

zahlen.txt
Code: (dl )
1
2
3
10 20 30 40 50 60 70 80
20 30 40 50 60 70 80
30 40 50 60 70 80


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
use strict;
use warnings;

my @output;
while ( my $line = <> ) {
my @zahlen = split /\s+/, $line;

my $row = 0;
for my $wert ( @zahlen ) {
push @{$output[$row++]}, $wert;
}
}

for my $row ( @output ) {
print "@$row\n";
}


Code: (dl )
1
2
3
4
5
6
7
8
9
sidburn@sid:~/perl$ ./zahlen.pl zahlen.txt
10 20 30
20 30 40
30 40 50
40 50 60
50 60 70
60 70 80
70 80
80
\n\n

<!--EDIT|sid burn|1181294149-->
Nicht mehr aktiv. Bei Kontakt: ICQ: 404181669 E-Mail: perl@david-raab.de

View full thread formatierte Datenausgabe