#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; my %tabelle; foreach my $line (split /\n/,<{$counter} = $head; $tabelle{typ}->{$counter} = $typ; } print Dumper(%tabelle);