in reply to question:File to hash using map

You could do this

use strict; use warnings; use Data::Dumper; my %hash = map { $_->[0] => join q{,}, @$_[1, 2] } map { chomp; [ split m{\s*,\s*} ] } <DATA>; print Dumper \%hash; __END__ A, B, C D,E,F G, H,I

The output

$VAR1 = { 'A' => 'B,C', 'D' => 'E,F', 'G' => 'H,I' };

Cheers,

JohnGG