my %hash = (); foreach my $x(@arr) { if ($x =~ m/(\w{6})(\w{4})/) #($1 = ersten 6 Zeichen / $2 = restliche 4) { $hash{$1} = $2; } }