#!/usr/bin/perl use warnings; use strict; use Text::CSV; use Data::Dumper; my %hash; my $csv = Text::CSV->new( { binary => 1 } ) or die "can't use CSV" . Text::CSV->error_diag(); while ( my $row = $csv->getline(*DATA) ) { push @{ $hash{ shift @$row } }, @$row; # as previously mentioned by Eily } $csv->eof or $csv->error_diag(); print Dumper \%hash; __DATA__ abc,2,3,4,5,6 abc,7,5,2,1,6,2,3 abc,8,2,1,3,1,4 def,8,9,4,5,6 def,5,6,2,1