#!/usr/bin/perl -w use strict; while () { my @parts = split/ {TAB} /,$_; for (1..$#parts) { print "$parts[0]\tFeld$_\t$parts[$_]\n"; } } __DATA__ ID1 {TAB} A C {TAB} A B {TAB} A T ID2 {TAB} A H {TAB} C V {TAB} C T