use Modern::Perl; use Text::CSV; use Data::Dumper; my $csv = Text::CSV->new () or die "Cannot use CSV: ".Text::CSV->error_diag (); open my $fh, "<", 'test.csv'; $csv->column_names ($csv->getline ($fh)); my $arrayref = $csv->getline_hr_all ($fh); say Dumper(\$arrayref); # __DATA__ # First,Second,Third # 1,2,3 # One,Two,Three # Een,Twee,Drie #### $VAR1 = \[ { 'Second' => '2', 'Third' => '3', 'First' => '1' }, { 'Second' => 'Two', 'Third' => 'Three', 'First' => 'One' }, { 'Second' => 'Twee', 'Third' => 'Drie', 'First' => 'Een' } ];