foreach $try (@array2) { $try =~/^(.*),"(.*)",(.*),(.*),"(.*)"/s; $a = $1; $b = $3; $c =$4; $d = $5; $a =~s/"//g; @bex = ($b, $4, $5); #this was the line I left out !! if (!$Tex{$a}){$Tex{$a} = [@bex]}; };