#!/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