#!/usr/bin/perl $sur = [ { 'one' => 'USA', 'two' => 'GOD', 'three' => '690557','four'=>'hello how are u',}, { 'one' => 'USA', 'two' => 'GOD', 'three' => '690557','four'=>'I am fine',}, { 'one' => 'UK', 'two' => 'GOD', 'three' => '690558','four'=>'I am Okay',}, ]; @array = @$sur; %hash1=(); foreach $key(@array) { %hash2 = %$key; $one = $hash2{one}; $two = $hash2{two}; $three = $hash2{three}; $four = $hash2{four}; $firstrow = $one."<-->".$two."<-->".$four; if($hash1{$three} ne "") { $hash1{$three} = $hash1{$three}."####".$four; } else { $hash1{$three} = $firstrow; } } ############## Output ######################## #while(($k,$v) = each(%hash1)) #{ #print "$k----->$v\n"; #} #Result Hash contain #'690557'=>'USA<=>GOD<=>hello how are u####I am fine' #'690558'=>'UK<=>GOD<=>I am Okay' ############## End ###########################