#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; my %HoA; while (<>) { chomp; if (index($_, ',') != -1) { my @fields = split(/,/, ); push @{ $HoA{$fields[0]} }, $fields[5]; } else { warn "Line could not be parsed: $_\n"; } } continue { close ARGV if eof; } print Dumper \%HoA; __END__ $ perl test.pl test.csv $VAR1 = { 'seetha' => [ 'rew' ], 'Anand' => [ 'xyz', 'wer', 'ert', 'tre' ] };