use Data::Dumper; while () { my ($name, $date, $rest) = split /\s+(\d{4})\s+/, $_, 3; my @rest = split ' ', $rest; print Dumper [$name, $date, @rest]; } __DATA__ Name1 2005 5 112 165 198 287 814.7 910 Name2, W. 2005 4 127 162 193 279 314 430 Name3 Vorname 2006 8 110 192 282 314.3 870