#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $file='namen.csv'; open(my $fh, '<', $file) or die("ERROR open $file ($!)\n"); my $csv = Text::CSV->new (); # first line my $key_names=$csv->getline( $fh ); # Array of hashes my @data; # read File while( my $row = $csv->getline( $fh ) ) { my $value={}; $value->{$key_names->[$_]}=$row->[$_] for(0..$#$key_names); push(@data,$value); } # Formated Output use Data::Dumper; print Dumper(\@data);