in reply to Multiple values for a single key

#!/usr/bin/perl # http://perlmonks.org/?node_id=1196722 use strict; use warnings; my %hash; while(<DATA>) { my ($key, $value) = ( /\w+/g )[0, -1]; push @{ $hash{$key} }, $value; } use Data::Dumper; print Dumper \%hash; __DATA__ Anand,1,2,3,4,xyz Anand,2,3,4,5,wer Anand,3,4,4,4,ert seetha,1,2,3,4,rew Anand,2,2,2,2,tre

Update

The output is

$VAR1 = { 'seetha' => [ 'rew' ], 'Anand' => [ 'xyz', 'wer', 'ert', 'tre' ] };