Thread MxN-Matrix in Tabelle umwandeln (7 answers)
Opened by abenstex at 2007-10-08 17:57

styx-cc
 2007-10-08 18:34
#100511 #100511
User since
2006-05-20
533 Artikel
BenutzerIn

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

chomp(my $line = <DATA>);
my @headers = split/ /,$line;
while (<DATA>) {
my @parts = split/ {TAB} /,$_;
for (1..$#parts) {
print "$parts[0]\t$headers[$_-1]\t$parts[$_]\n";
}
}

__DATA__
Gurke Tomate Banane
ID1 {TAB} A C {TAB} A B {TAB} A T
ID2 {TAB} A H {TAB} C V {TAB} C T
Pörl.

View full thread MxN-Matrix in Tabelle umwandeln