$new [0] = a 1 $new [1] = a 2 $new [2] = b 1 $new [3] = b 2 $new [4] = c 1 #### $new[0] = a $new[1] = 1 $new[2] = a $new[3] = 2 $new[4] = b #### I am using push to put this array in @result. And then I am putting $test values in. I am trying to have this new array where the first element will be $new[0] and first value of $test. for ($k=0;$k<$num_a;$k++){ $num_b = @lad; for ($y=0;$y<$num_b;$y++){ $lad[$y]=~/^(.*?)=(.*?)$/; $test = $2; chop($test); push(@result,$new[$k]); push(@result,$test); } } print "RESULT = @result\n";